llms.txt check (AI SEO)
Five layers an AI agent or answer engine reads. Add them, then prove them on the live site with scripts/check.sh, never by reading your own code.
| layer | what | template |
|---|---|---|
| 1. Permission | robots.txt with Content-Signal: search=yes, ai-train=yes, ai-input=yes, and no Disallow: / for GPTBot, ClaudeBot, PerplexityBot, Google-Extended, OAI-SearchBot |
templates/robots.txt |
| 2. Map | /llms.txt: who you are, sections with links, a "notes for answer engines" block. Every claim must also be on a page: engines cite page text, not llms.txt |
templates/llms.txt |
| 3. Clean text | Accept: text/markdown on any HTML page returns the page's <main> as markdown; HTML responses say Vary: Accept |
templates/functions/_middleware.js (Pages Functions) |
| 4. Discovery | Link: </.well-known/api-catalog>; rel="api-catalog" header and a linkset JSON at that path |
templates/_headers, templates/.well-known/api-catalog |
| 5. Structure | JSON-LD on pages; list pages (categories, collections) carry an ItemList of their items |
build step of your site |
Steps
- Run
scripts/check.sh <domain>first. It prints one PASS/FAIL row per layer and exits 1 on any FAIL; exit 2 (UNKN site-access) means the site refuses non-browser clients, so tell the user AI agents are blocked at the door and stop there. Keep this output as the "before". - Copy the templates for the FAILed layers. Replace
example.com. On Cloudflare Pages, keep/llms.txt,/robots.txt,/sitemap.xml,/.well-known/*and static assets out of the function in_routes.jsonexclude. - Deploy, then run
scripts/check.sh <domain>again and also with a deep page:scripts/check.sh <domain> /some/page/. Done = every row PASS on the live site.
Traps found on real sites
- Edge cache ignores Vary. A zone rule that caches HTML ("Cache Everything") serves the cached HTML to a markdown request before your function runs. Symptom:
markdown-on-acceptFAILs on/but PASSes on/?x=1or deep pages, withcf-cache-status: HIT/REVALIDATED. Fix: bypass cache when the requestAcceptcontainstext/markdown, or don't cache HTML at the edge. - Never cache the markdown response (
cache-control: no-store): cache keys ignoreAccept. - An AI-crawler block in the host's bot settings beats your robots.txt. On Cloudflare, check the zone's AI crawler / bot settings too; blocking "training" can also block search crawlers.
llms.txtwith numbers that are not on any page is not GEO; put the facts in page text first.curlof the root returning 200 proves nothing about layer 3: test with theAcceptheader, on the path agents actually fetch.