Add the five endpoints that serve alternate Markdown/MDX versions, site and section llms.txt indexes, and llms-full.txt. The Nimbus integration must already be present in astro.config.ts.
1. Add alternate page versions
Create the clean Markdown version:
import { markdownRoute } from "@cloudflare/nimbus-docs/agent-endpoints";
export const prerender = true;
export const { GET, getStaticPaths } = markdownRoute();Create the MDX source version:
import { markdownSourceRoute } from "@cloudflare/nimbus-docs/agent-endpoints";
export const prerender = true;
export const { GET, getStaticPaths } = markdownSourceRoute();These two routes serve every collection, including docs versions, a blog at /blog, and API references. API pages have a .md version but no .mdx source. Pages in hidden versions have neither. Collections you add later need no new route files. To customize the output for some or all pages, see Override a default.
Both routes must stay prerendered. The build fails if either one is rendered on request.
2. Add the site index
Create the site-wide discovery index:
import { llmsRoute } from "@cloudflare/nimbus-docs/agent-endpoints";
export const prerender = true;
export const { GET } = llmsRoute();3. Add llms-full.txt
Create the file containing all discoverable documentation:
import { llmsFullRoute } from "@cloudflare/nimbus-docs/agent-endpoints";
export const prerender = true;
export const { GET } = llmsFullRoute();4. Add section indexes
Create the route for paths such as /writing/llms.txt:
import { llmsSectionRoute } from "@cloudflare/nimbus-docs/agent-endpoints";
export const prerender = true;
export const { GET, getStaticPaths } = llmsSectionRoute();Each GET returns 404 for an unknown section. Rendered on request, it returns a 500 without details when an index can’t be read, and logs the error. To change what a route serves, see Override a default.
Keep the llms.txt endpoints prerendered unless you deliberately want them rendered on request. The agent-endpoints helpers support either mode and require the Nimbus Astro integration. The build warns about every Markdown version or llms.txt index that no prerendered route generated, and names the route that serves it; ignore the warning for routes you render on request on purpose.
Verify
Run a production build, then start Astro’s production preview:
pnpm build
pnpm previewIn another terminal, replace get-started and writing with routes that exist in the project. If Astro has a deployment base, prefix each path with it:
curl --fail http://localhost:4321/get-started/index.md
curl --fail http://localhost:4321/get-started/index.mdx
curl --fail http://localhost:4321/llms.txt
curl --fail http://localhost:4321/llms-full.txt
curl --fail http://localhost:4321/writing/llms.txtEach command must return content with a successful status. A 404 means the corresponding route file is missing. If the build reports an unprepared collection, wrap its Markdown loader with withNimbusMarkdown() as described in Other collections. If a section index is absent, confirm that the section has discoverable pages and appears in /llms.txt.
Direct rendering
renderEntryAsMarkdown() and getEntryMarkdown() remain available for entry bodies that do not contain <Render>. Passing a body with <Render> throws. Use the endpoints above for alternate authored Markdown versions and llms.txt indexes. getEntryMarkdown() also loads API citation data and is intended for prerendered routes.