llms.txt

Publish a compact, machine-readable map of your documentation.

Included in starter templates

This functionality is already configured in the starter templates. Follow the complete setup in the Quickstart.

/llms.txt is the small entry point for an AI assistant or any tool that needs to discover your documentation. Heyo Docs generates it from the same pages and navigation model that power the site, so links do not drift from the sidebar.

The file contains the documentation title and description, then an absolute Markdown URL for each page. It points agents to the smaller, page-level documents first; an agent can load only the context needed for a question instead of retrieving the complete site.

What to publish

Set siteUrl in heyo-docs.config.ts before deploying. That makes the links in the generated index deterministic and correct in previews, crawlers, and production:

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

Serve the result as plain text at exactly /llms.txt with content-type: text/plain; charset=utf-8. The framework guides show the route for React Router, Next.js, and Astro.

How agents should use it

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

llms.txt is a discovery aid, not an access-control mechanism. Publish only content that is already intended to be public.

React Router

Create a project

A project created with create-heyo-docs already publishes /llms.txt. The template registers the resource route, reads the server-side content registry, and prerenders the file for static deployments. Set siteUrl in the generated configuration before deployment.

bun create @heyo-sh/heyo-docs my-docs --template react-router

Manual, minimal configuration

In an existing React Router Framework Mode app, add the resource route before the documentation catch-all and return the generated index from its loader:

app/routes.ts
route("llms.txt", "routes/llms.ts"),
route("*", "routes/docs.tsx"),
app/routes/llms.ts
import { llmsIndex } from "@heyo-sh/heyo-docs";
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" },
  });
}

Add /llms.txt to the prerender() result in react-router.config.ts when the site is deployed statically.

Next.js

Create a project

The Next.js template generated by create-heyo-docs includes the Route Handler and the generated Markdown registry it needs. No additional AI-agent setup is required after creation.

bun create @heyo-sh/heyo-docs my-docs --template next

Manual, minimal configuration

First run generateNextContent() before development and builds, as described in the Next.js setup guide. Re-export markdownPages and config from the server-only docs helper, then add this App Router handler:

app/llms.txt/route.ts
import { llmsIndex } from "@heyo-sh/heyo-docs/node";

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" },
  });
}

Astro

Create a project

The Astro template generated by create-heyo-docs includes a static src/pages/llms.txt.ts API route. It is generated with the rest of the site; only siteUrl needs to be set for canonical links.

bun create @heyo-sh/heyo-docs my-docs --template astro

Manual, minimal configuration

After adding heyoDocsAstro({ config }) to astro.config.ts, create an API route that reads the server-side virtual page registry:

src/pages/llms.txt.ts
import type { APIRoute } from "astro";
import { llmsIndex } from "@heyo-sh/heyo-docs";

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" },
  });
};