What Astro does today
Astro does not generate llms.txt. On 2026-10-19, a search for "llms" in the Astro integrations directory with the Official filter returned 0 results. The same search without the filter listed many community packages. Astro's own docs site returned 404 for /llms.txt that day.
You can add the file in two ways that Astro supports out of the box: copy a static file, or generate it at build time with an endpoint. llms.txt mostly helps coding agents and tools that fetch documentation, not Google or chat-assistant visibility. Documentation sites gain the most.
Add llms.txt to Astro
-
Static file. Create
public/llms.txt. Astro's docs say files inpublic/"will be copied into the build folder untouched" and namerobots.txtas a typical example, sopublic/llms.txtends up at/llms.txt.# Example Co > Project-planning software with a REST API. Start with the guides. ## Docs - [Quickstart](https://example.com/docs/quickstart): Create a project in five minutes -
Generated file. Create
src/pages/llms.txt.ts. Astro removes the.tsextension at build time, so this file builds/llms.txt. In a static site, Astro calls endpoints "at build time to produce static files". UsegetCollection()to list your pages.import type { APIRoute } from "astro"; import { getCollection } from "astro:content"; export const GET = (async ({ site }) => { const docs = await getCollection("docs"); const links = docs .map((entry) => `- [${entry.data.title}](${new URL(`/docs/${entry.id}/`, site)})`) .join("\n"); const body = `# Example Co\n\n> Project-planning software with a REST API.\n\n## Docs\n\n${links}\n`; return new Response(body, { headers: { "Content-Type": "text/plain; charset=utf-8" }, }); }) satisfies APIRoute;Change
"docs"to your collection name,titleto a field your schema defines, and the/docs/${entry.id}/path to match your page URLs. We did not run this snippet in a real project. -
Set
site. Addsite: "https://example.com"toastro.config.mjs. The endpoint receives it assite, which isundefinedwhen the option is not set. -
On-demand only if you need it. The build-time endpoint works in a fully static site. If the file must change between deploys, enable an on-demand rendering mode. In
staticmode, addexport const prerender = falseto the endpoint. -
Or use a community package. For a Starlight docs site,
starlight-llms-txtgeneratesllms.txt,llms-full.txtandllms-small.txt. It needssiteset. A GitHub user maintains it, not the withastro organization. Other packages in the directory are community-maintained too. Check each README and its supported Astro version.
Check that it works
Run astro build and look for llms.txt at the top of your build folder. After you deploy, run curl -sI https://example.com/llms.txt. Expect a 200 status and a text content type, not your 404 page as HTML. Astro's docs do not say what content type a host sends for a .txt file, so check the header.
Paste the file into the llms.txt validator. The llms.txt exists check explains what the audit accepts.
Limits and workarounds
basemoves the pages. Astro's docs saybaseis "the root for your pages and assets". Withbase: "/docs", expect the endpoint at/docs/llms.txt. We could not verify from Astro's documentation thatpublic/files move too. The audit requests/llms.txtat your domain root and tries thedocs.,developers.anddeveloper.subdomains. It does not try sub-paths. To pass, serve a copy at the domain root or host the docs on one of those subdomains.- No trailing slash. Astro's docs say endpoints with a file extension "can only be accessed without a trailing slash". Link to
/llms.txt, not/llms.txt/. - Keep it curated. List the pages you would send a new engineer to. Your sitemap already lists every URL.