smolter
Types

LinksFunction

Describe static document links on the root module.

Compatibility

ReactAvailable in this renderer's browser integration.
React SSRAvailable to this renderer's SSR integration; browser event handlers run after hydration.
PreactAvailable in this renderer's browser integration.
Preact SSRAvailable to this renderer's SSR integration; browser event handlers run after hydration.

Import from @kasperrt/smolter/react @kasperrt/smolter/preact

Signature

type LinksFunction = () => Record<string, string>[];

Contract

A zero-argument function returning arrays of string-valued link attributes. Links renders those descriptors as link elements in the document.

import type { LinksFunction } from "@kasperrt/smolter/preact";

export const links: LinksFunction = () => [
  { rel: "icon", href: "/favicon.svg", type: "image/svg+xml" },
];

Usage and limits

Place it on the root module and render Links in the root Layout head. This is separate from route metadata’s tagName: "link" descriptors. Asset URLs may be Vite imports or deployment URLs owned by the application.

View implementation ↗