Stone.js API
    Preparing search index...

    A fluent head builder. Every method returns this for chaining; toContext produces the final HeadContext.

    Index
    • Create a HeadManager, optionally seeded from an existing context.

      Parameters

      • Optionalinitial: HeadContext

        An initial head context to extend.

      Returns HeadManager

    • Set an alternate link (e.g. hreflang or RSS feed).

      Parameters

      • href: string

        The alternate URL.

      • Optionalattrs: Record<string, unknown>

        Extra attributes (e.g. { hreflang: 'fr' }, { type: 'application/rss+xml' }).

      Returns this

    • Set the <base> element.

      Parameters

      • href: string

        The base href.

      • Optionaltarget: string

        The base target.

      Returns this

    • Set attributes on the <body> element.

      Parameters

      • attributes: Record<string, string>

        Attribute map.

      Returns this

    • Set the canonical URL (<link rel="canonical">).

      Parameters

      • href: string

        The canonical URL.

      Returns this

    • Set the document character set (<meta charset>).

      Parameters

      • Optionalvalue: string

        The charset (default utf-8).

      Returns this

    • Set the meta description (and the og:description fallback source).

      Parameters

      • value: string

        The description text.

      Returns this

    • Set attributes on the <html> element.

      Parameters

      • attributes: Record<string, string>

        Attribute map (e.g. { lang: 'en' }).

      Returns this

    • Add a JSON-LD structured-data block (<script type="application/ld+json">).

      Parameters

      • data: Record<string, unknown>

        The JSON-LD object.

      Returns this

    • Add a link descriptor (deduped by rel+href).

      Parameters

      • descriptor: LinkDescriptor

        The link descriptor.

      Returns this

    • Merge another head context (or manager) into this one. Later values win; metas/links are deduped. Enables hierarchical heads (layout head + page head).

      Parameters

      • other: HeadContext | HeadManager

        The head context or manager to merge in.

      Returns this

    • Add or replace a raw meta descriptor (deduped by name/property/charset).

      Parameters

      • descriptor: Record<string, unknown> | MetaDescriptor

        The meta descriptor.

      Returns this

    • Add Open Graph meta tags. Falls back to the current title/description when omitted.

      Parameters

      Returns this

    • Add a preload/prefetch/modulepreload link.

      Parameters

      • href: string

        The resource URL.

      • Optionalas: string

        The as attribute (e.g. script, style, font, image).

      • Optionalrel: "preload" | "prefetch" | "modulepreload"

        The relationship (default preload).

      Returns this

    • Set robots directives (<meta name="robots">).

      Parameters

      Returns this

    • Add a script descriptor (external via src, or inline via content).

      Parameters

      • descriptor: ScriptDescriptor

        The script descriptor.

      Returns this

    • Add an inline style block.

      Parameters

      • css: string

        The CSS text.

      • Optionalattrs: Record<string, unknown>

        Extra attributes (e.g. media).

      Returns this

    • Add a stylesheet link.

      Parameters

      • href: string

        The stylesheet URL.

      • Optionalattrs: Record<string, unknown>

        Extra attributes (e.g. media).

      Returns this

    • Set the theme color meta.

      Parameters

      • value: string

        A CSS color.

      Returns this

    • Set the document title.

      Parameters

      • value: string

        The title text.

      Returns this

    • Set a title template, e.g. '%s — Stone.js' where %s is replaced by the title.

      Parameters

      • template: string

        The template string containing %s.

      Returns this

    • Produce the final head context. The title template (if any) is applied to the title.

      Returns HeadContext

      The resolved HeadContext.

    • Add Twitter card meta tags. Falls back to the current title/description when omitted.

      Parameters

      Returns this

    • Set the viewport meta (default mobile-friendly value).

      Parameters

      • Optionalvalue: string

        The viewport content.

      Returns this