JSON-LD
Generate canonical metadata, structured data, and breadcrumbs from the Heyo Docs page model.
Loading documentation…
This is already configured in projects created with create-heyo-docs. No action is required if you used the creator to install Heyo Docs.
Heyo Docs creates metadata and JSON-LD from the site configuration, MDX frontmatter, navigation, and OpenAPI model. This keeps canonical URLs, breadcrumbs, social previews, and structured data aligned with the pages that are actually published.
Set a production siteUrl, title, and description first. siteUrl must be a
clean HTTP(S) base URL without a query string or fragment.
The URL is used for canonical links, Open Graph and Twitter metadata, breadcrumb URLs, and structured-data links. If it is omitted, pages still render, but absolute canonical and JSON-LD URLs are not emitted.
Give each reader-facing MDX page a specific title and description. They become
the TechArticle name and description for regular documentation pages:
Heyo Docs emits a TechArticle and BreadcrumbList for an MDX page. A
changelog page becomes a CollectionPage; generated OpenAPI operations become
APIReference entries with an EntryPoint when the schema provides the
required details. Unknown documentation paths should receive noindex
metadata.
The SEO data is generated by Heyo Docs, but each framework has its own metadata and document-head API. Use the implementation for the framework that renders your documentation routes. Do not maintain a second set of hand-written canonical tags or JSON-LD in MDX.
Add site-wide metadata in app/root.tsx:
In the documentation route, resolve the current page or OpenAPI endpoint from
the same model passed to DocsApp, then return docsSeoMeta() from meta:
siteSeoMeta() and docsSeoMeta() return React Router metadata descriptors,
including safely serialized JSON-LD. The generated React Router starter already
includes both integrations.
Use docsSeo() for each docs page and pass the returned title, description,
canonical URL, and structured data into the Astro layout. The generated Astro
template does this in src/pages/[...slug].astro:
The layout owns the document head. Serialize the structured data with the Heyo Docs helper instead of interpolating JSON by hand:
docsContext() should resolve the page, endpoint, navigation, and changelog
group from createDocsModel(), as in the Astro starter. Apply the same pattern
to src/pages/index.astro for the root documentation page.
Create the site-wide metadata in the root layout with nextSiteSeo() and
serialize its site-level JSON-LD:
On the App Router docs page, use nextDocsSeo() in generateMetadata() and
render its page-specific structured data. docsContext() below is the
server-only helper that resolves the current page or OpenAPI endpoint from the
same generated model as the docs UI:
The generated Next.js starter already provides docsContext() and
pathnameForSegments() in app/lib/docs.ts, backed by its generated
server-side content registry.