1. Documentation
  2. Tutorials
  3. llms.txt
ReadmeGitHub
  • Introduction
  • Quickstart
  • Text
  • Code
  • Lists
  • Tables
  • Accordion
  • Badge
  • Button
  • Callout
  • Code Block
  • Code Block Group
  • Code Snippet
  • Columns
  • Custom components
  • GitHub
  • Hover Card
  • Mermaid
  • Properties
  • Related Topics
  • Tabs
  • Tree
  • Images
  • Video
  • Files
  • Grain
  • Shade
  • Moss
  • Configuration
  • Content
  • Navigation
  • Site Identity
  • Appearance
  • Header and Footer
  • Fonts
  • Icons
  • Integrations
  • Search
  • OpenAPI
  • AI Chat
  • React Router
  • Astro
  • Next.js
  • Cloudflare
  • Vercel
  • robots.txt
  • sitemap.xml
  • JSON-LD
  • rss.xml
  • llms.txt
  • llms-full.txt
  • .md endpoints

llms.txt

Publish a compact AI-agent index that links to the Markdown version of every documentation page.

Loading documentation…

rss.xml< Previousllms-full.txtNext >

Powered by heyo

On this page

Set the public URLHow agents should use itAdd the routeReact RouterAstroNext.js
Included with create-heyo-docs

This is already configured in projects created with create-heyo-docs. No action is required if you used the creator to install Heyo Docs.

/llms.txt is the compact entry point for AI assistants and other tools that need to discover your documentation. Heyo Docs generates it from the same pages and navigation model as the site, then links to individual Markdown pages so an agent can load only the context it needs.

Set the public URL

Set siteUrl before deployment. It makes the Markdown URLs in the index absolute and stable:

heyo-docs.config.ts
export default heyoDocs({  siteUrl: "https://docs.example.com",  // ...});

Serve the result at exactly /llms.txt with content-type: text/plain; charset=utf-8. The file is public, so include only content that is already intended for readers.

How agents should use it

  1. Fetch /llms.txt to discover the documentation pages.
  2. Choose the relevant *.md URL from the list.
  3. Fetch that Markdown page and answer from its contents.
  4. Fetch /llms-full.txt only when the task requires the whole corpus.

Targeted page retrieval keeps context smaller and easier to inspect than loading every article for an ordinary question.

Add the route

This route depends on the framework's server-resource convention. It also requires the .md endpoints, because those are the URLs listed in the index.

React Router

Register the resource route before the documentation catch-all:

app/routes.ts
route("llms.txt", "routes/llms.ts"),route("*", "routes/page.tsx"),

Then create app/routes/llms.ts:

app/routes/llms.ts
import { llmsIndex } from "@heyo-sh/heyo-docs/llm";import type { LoaderFunctionArgs } from "react-router";import config from "../../heyo-docs.config";import { pages } from "virtual:heyo-docs-content/server";export function loader({ request }: LoaderFunctionArgs) {  const siteUrl = config.siteUrl ?? new URL(request.url).origin;  return new Response(llmsIndex(pages, config, siteUrl), {    headers: { "content-type": "text/plain; charset=utf-8" },  });}

For static React Router deployments, preserve /llms.txt in prerender().

Astro

Create src/pages/llms.txt.ts:

src/pages/llms.txt.ts
import type { APIRoute } from "astro";import { llmsIndex } from "@heyo-sh/heyo-docs/llm";import config from "../../heyo-docs.config";import { pages } from "virtual:heyo-docs-content/server";export const GET: APIRoute = ({ request }) => {  const siteUrl = config.siteUrl ?? new URL(request.url).origin;  return new Response(llmsIndex(pages, config, siteUrl), {    headers: { "content-type": "text/plain; charset=utf-8" },  });};

With Astro static output, this becomes a generated /llms.txt asset.

Next.js

Create app/llms.txt/route.ts:

app/llms.txt/route.ts
import { llmsIndex } from "@heyo-sh/heyo-docs/llm";import { config, markdownPages } from "../lib/docs";export function GET(request: Request) {  const siteUrl = config.siteUrl ?? new URL(request.url).origin;  return new Response(llmsIndex(markdownPages, config, siteUrl), {    headers: { "content-type": "text/plain; charset=utf-8" },  });}

markdownPages is the generated server-side page registry from the Next.js starter. Use the equivalent registry in a custom integration.