Guide
How to add an llms.txt to an Astro site (2026 guide)
Updated · July 10, 2026 — Joffrey
What is GEO?→Astro doesn't serve an llms.txt file by default. Here's how to add one — plus Q&A schema.org markup — so AI answer engines can read your Astro site and cite it in their answers. The steps are concrete and take a few minutes.
Why add an llms.txt on Astro?
AI answer engines (ChatGPT, Perplexity, Gemini, Claude) cite only a handful of sources per question, and they favor pages they can read cleanly. An llms.txt hands them a clear, structured version of your site; Q&A schema.org markup makes your answers quotable word for word. Without it, even ranking well on Google, your Astro site is unlikely to appear in an AI answer — not for lack of quality, but because nothing is machine-readable.
Add the llms.txt and Q&A markup on Astro
- Q&A markup: add it inside your layout's
<head>(src/layouts/*.astro) with theis:inlineattribute so Astro doesn't transform it. llms.txt,llms-full.txtandrobots.txt: place them in thepublic/folder — Astro copies them as-is to the root (public/llms.txt→/llms.txt).- If you already generate
robots.txtvia an integration (e.g.astro-robots-txt) or an endpoint, don't also add a static file: it would collide. Merge our lines into one of the two.
Verify it's live
Open your-site.com/llms.txt in a browser: you should see the file in plain text. Then test a page in Google's Rich Results Test to confirm the Q&A JSON-LD is detected. Until both checks pass, AI engines see nothing.