SEO
Generate robots.txt, sitemap.xml, JSON-LD, and RSS from your documentation.
robots.txt
This functionality is already configured in the starter templates. Follow the complete setup in the Quickstart.
Publish robots.txt at the site root to tell crawlers that documentation pages
may be indexed while keeping Heyo Docs' internal Markdown resource route out of
search results. Every generated template serves the same response at
/robots.txt:
Set siteUrl in heyo-docs.config.ts before deployment. It is used for the
absolute sitemap URL. During a preview, the route falls back to the origin of
the incoming request.
robots.txt is advisory: it does not protect a route or remove an already
public document from the web. Keep private content outside the published
documentation directory and protect private application routes separately.
React Router
Create a project
The React Router template includes the resource route and prerenders it for static deployments.
Manual, minimal configuration
Register the resource route before the documentation catch-all:
Return a plain-text response from the route. The configured site URL is used when available, so the same implementation works in local previews.
For static hosting, include /robots.txt in the array returned by
prerender() in react-router.config.ts.
Next.js
Create a project
The Next.js template includes an App Router Route Handler at
app/robots.txt/route.ts.
Manual, minimal configuration
After exposing config from the server-only docs helper, add this handler:
Astro
Create a project
The Astro template emits the root endpoint from src/pages/robots.txt.ts.
Manual, minimal configuration
Add an API route under src/pages:
Sitemap
This functionality is already configured in the starter templates. Follow the complete setup in the Quickstart.
Heyo Docs generates /sitemap.xml from the same documentation model that
renders navigation and pages. It includes every MDX page and every generated
OpenAPI endpoint route, so the sitemap stays aligned with the site after a
content or schema change.
The response is an XML sitemap with one absolute <loc> entry per route:
Set siteUrl in heyo-docs.config.ts so production URLs are deterministic.
Without it, the route uses the current request origin, which is useful for a
preview but should not replace a canonical production URL.
sitemapXml() escapes generated XML and accepts a base URL plus an array of
paths. It deliberately publishes URLs only; it does not infer lastmod,
priority, or change frequency.
React Router
Create a project
The React Router template registers /sitemap.xml and adds it to its static
prerender list.
Manual, minimal configuration
Register the route ahead of the documentation catch-all:
Build the model with the compiled MDX page registry and OpenAPI documents, then serialise both sets of routes:
Add /sitemap.xml to prerender() when deploying the React Router app as
static files.
Next.js
Create a project
The Next.js template generates the docs model before development and builds, then exposes this Route Handler automatically.
Manual, minimal configuration
First configure the server-only docs helper to export config and docsModel.
Then add the handler:
Astro
Create a project
The Astro template includes the static API route at
src/pages/sitemap.xml.ts.
Manual, minimal configuration
Build the model from Astro's virtual registries and return its URLs:
JSON-LD
This functionality is already configured in the starter templates. Follow the complete setup in the Quickstart.
The generated application metadata describes the documentation to crawlers and social previews without requiring per-page hand-written tags. The templates use the page's MDX frontmatter, the navigation model, and OpenAPI metadata to emit canonical URLs, Open Graph and Twitter fields, and JSON-LD.
Set a production siteUrl first. Heyo Docs removes a trailing slash and uses
the value as the base for canonical URLs, breadcrumbs, sitemap entries, and
structured-data links.
siteUrl must be an HTTP(S) base URL without a query string or fragment. If it
is omitted, the pages remain renderable, but canonical and absolute structured
data URLs are not emitted.
Metadata by page type
For regular MDX documentation, Heyo Docs emits a TechArticle plus a
BreadcrumbList. The article title and description come from frontmatter;
when the description is empty, the site-level description is used.
Changelog pages become CollectionPage records. Each <Update> entry is
listed as a TechArticle in hasPart, including its tags as keywords. An
OpenAPI operation becomes an APIReference with an EntryPoint that includes
the HTTP method, URL template, and request or response content type when the
schema supplies them.
All successful documentation routes declare robots: index, follow. The
framework adapters return a noindex response for a route that does not match
an MDX page or generated endpoint.
Root metadata
The root document is a WebSite. Templates also include the site title and
description, og:type=website, a summary Twitter card, a referrer policy, and
an RSS discovery link when a changelog group exists.
The JSON-LD string replaces < with \u003c before it is inserted into a
script tag. This prevents page content from ending the script element.
React Router
Create a project
The React Router template configures root metadata in app/root.tsx and
per-page metadata in app/lib/seo.ts with app/routes/docs.tsx.
Manual, minimal configuration
Resolve the current page from the documentation model, then return metadata
from the route's meta function. The generated helper adds title,
description, canonical, Open Graph, Twitter, JSON-LD, and breadcrumbs.
Use the template's app/lib/seo.ts as the helper implementation. Its output
is a React Router meta descriptor that includes the script:ld+json entry.
Next.js
Create a project
The Next.js template uses the Metadata API for standard tags and injects the
structured-data array from app/lib/seo.ts on each static docs page.
Manual, minimal configuration
Generate metadata and JSON-LD from the same resolved docs context:
The root app/layout.tsx adds the site-wide WebSite JSON-LD and Next
metadata, including metadataBase when siteUrl is configured.
Astro
Create a project
The Astro template calls docsSeo() for every emitted page and passes its
result to DocsLayout.
Manual, minimal configuration
Resolve page data in the dynamic route and spread the metadata into a layout that renders the standard tags and JSON-LD script:
DocsLayout serialises structuredData with the same < escaping and adds
canonical, Open Graph, Twitter, RSS, and robots tags around the documentation
application.
RSS
This functionality is already configured in the starter templates. Follow the complete setup in the Quickstart.
Heyo Docs publishes an RSS 2.0 feed at /rss.xml for changelog updates. It
reads the same MDX <Update> entries that power the changelog UI, so feed
items, tags, descriptions, and anchors stay in sync with the rendered page.
Only pages selected by a changelog group are included. Ordinary documentation pages are deliberately excluded from the feed.
Define changelog updates
Configure a group with type: "changelog" and point updates at the MDX
pages that contain the entries:
Each <Update> needs a label. tags and the ISO 8601 date are optional,
but a date allows the feed to emit an RSS pubDate.
The feed creates an item URL from the documentation URL and the update anchor,
for example https://docs.example.com/changelog#version-2-4. It includes the
plain-text update body as the description and turns each tag into an RSS
category. Text is XML-escaped before it is returned.
The document is served with:
When a changelog group exists, the root layout also advertises the feed with a
rel="alternate" link so browsers and feed readers can discover it.
React Router
Create a project
The React Router template includes /rss.xml, adds it to prerender(), and
places the discovery link in the root document whenever a changelog group is
configured.
Manual, minimal configuration
Register the resource route before the documentation catch-all:
Generate the feed from the server-side virtual MDX registry:
Include /rss.xml in the prerender() result for static deployments. Add the
discovery link conditionally in app/root.tsx:
Next.js
Create a project
The Next.js template adds an App Router Route Handler and declares the feed as an alternate type in root metadata when a changelog exists.
Manual, minimal configuration
After generating and exporting config and markdownPages from the server-
only docs helper, add the route:
For discovery, set alternates.types["application/rss+xml"] to
"/rss.xml" in the root Metadata only when a changelog group is present.
Astro
Create a project
The Astro template includes a static src/pages/rss.xml.ts API route and an
RSS alternate link in DocsLayout when the configuration has a changelog.
Manual, minimal configuration
Create the root API route and generate the feed from the server page registry: