Every page already has a Markdown version at /<slug>/index.md. With Markdown negotiation, a request to the page’s own URL with Accept: text/markdown gets that Markdown too, so an agent doesn’t need to know the .md convention.
Prerequisites
siteset to your production origin in the Nimbus config- A host with a server adapter: Cloudflare, Netlify, Node or Vercel
Steps
Add a server adapter
Skip this step if the site already has one. For Cloudflare:
npx @cloudflare/nimbus-docs add adapter-cloudflareyarn nimbus-docs add adapter-cloudflarepnpm nimbus-docs add adapter-cloudflarebunx @cloudflare/nimbus-docs add adapter-cloudflareOther hosts use
adapter-netlify,adapter-nodeoradapter-vercel.Render the docs on request
In
astro.config.ts, set the docs collection to render on request:astro.config.tsts const nimbusConfig = defineNimbusConfig({ site: "https://docs.example.com", // … rendering: { collections: { docs: "request" } }, });Build and deploy
Deploy the server and the generated Markdown files together. Off Cloudflare, the server reads the Markdown from
site, so the files must be reachable there.
Verify
Request a page with Markdown first in the Accept header:
curl -I -H 'Accept: text/markdown' https://docs.example.com/guide/HTTP/2 200
content-type: text/markdown; charset=utf-8
vary: AcceptThe Markdown form is answered before the page’s HTML renders: the request goes to the route that serves the page’s Markdown, so the response carries that route’s headers (and an ETag of the Markdown) rather than headers the page sets for its HTML. A request with If-None-Match naming that ETag is answered 304 Not Modified, as is a direct .md, llms.txt or llms-full.txt request. Wrap markdownRoute()’s GET to add headers to the Markdown form; to change its text, pass body, which keeps the ETag over the bytes sent.
When a request-rendered route finds no page, it answers the same request with a 404 and a short Markdown body that links /llms.txt and the sitemap. The starter’s docs route answers every URL, so every missing page gets it. If your docs live under a prefix such as /guides/, a URL outside it gets your HTML 404 page.
If content-type is text/html, the page is still prerendered: check that its collection is set to "request". A browser’s Accept: */* always gets HTML.
Static sites
A prerendered page is served before any server code runs, so it can’t negotiate. On Cloudflare, turn on Markdown for Agents for the zone instead: Cloudflare converts the HTML when an agent asks for Markdown.
API references
Generated API references render on request only with the Cloudflare adapter. On other adapters, keep API collections set to "build" while the docs use "request".
Next steps
- Markdown and llms.txt: the
.mdversions this serves. - Override generated Markdown: change what a page’s Markdown contains.