How to Add llms.txt to Your Site (Astro, Next.js, WordPress)
llms.txt is a voluntary proposal for publishing a curated Markdown map at a domain root. A service may choose to consume it; adoption by major answer engines should not be assumed. Google Search explicitly ignores llms.txt, including for AI Overviews and AI Mode, so it neither helps nor hurts Google visibility.
The format (90 seconds)
CiteFuel treats a proposal-compliant llms.txt as having these structural elements:
# Your Site Name
> One sentence describing what the site is and who it serves.
https://yourdomain.com/
## Main Sections
- [Page Title](https://yourdomain.com/page): one-line description of the page
- [Another Page](https://yourdomain.com/another): what an AI should know it covers
## Docs
- [Getting Started](https://yourdomain.com/docs/start): installation and first run - The
#H1 site name must be the first content line. - The
>blockquote is the proposal's one-sentence site summary; no consumer is required to quote or use it. - Sections (
##) group- [Title](URL): descriptionentries. Absolute https URLs only. - List useful canonical pages rather than every URL. The proposal does not guarantee discovery or citation.
Don't hand-roll it if you have a sitemap: the free generator builds a reviewable proposal-format draft from URLs in your submitted sitemap. It does not fetch every page or independently verify that each URL still resolves.
How do I add llms.txt in Astro?
Astro serves anything in public/ verbatim from the site root. Create
public/llms.txt, paste your content, deploy. That's the whole implementation:
your-project/
├── public/
│ ├── llms.txt ← here
│ └── robots.txt
└── src/…
Astro won't process or rename it; it ships byte-for-byte at /llms.txt with a sensible
text/plain content type. If you generate pages from a content collection, you can also render it
dynamically with an endpoint at src/pages/llms.txt.ts that walks your collection and
returns the Markdown — useful when your page list changes weekly.
How do I add llms.txt in Next.js?
Static (App or Pages router): identical idea — drop the file in public/llms.txt. Next serves public/ from the root.
Dynamic (App router): create a route handler so the file always reflects current content:
// app/llms.txt/route.ts
export async function GET() {
const body = [
'# Acme',
'',
'> Acme makes billing infrastructure for veterinary clinics.',
'',
'https://acme.com/',
'',
'## Product',
'- [Pricing](https://acme.com/pricing): plans and per-seat pricing',
// …generate entries from your CMS or route manifest
].join('\n');
return new Response(body, {
headers: { 'Content-Type': 'text/plain; charset=utf-8' },
});
}
Avoid middleware rewrites that might intercept /llms.txt — check it returns 200 in
production, not your SPA shell.
How do I add llms.txt in WordPress?
Three options, best first:
- Upload to the web root. Via SFTP or your host's file manager, place llms.txt next to wp-config.php. Survives theme changes; bypasses WordPress entirely.
- Plugin. Several maintained plugins (search the directory for "llms.txt") generate the file from your published pages and keep it updated on publish — the right choice if you don't have file access.
- functions.php rewrite for the comfortable: register a rewrite for
llms.txtand emit the Markdown from a template. More moving parts; only worth it for heavily dynamic sites.
Watch for caching/security plugins and CDN rules that block unknown root files — after deploying, fetch
https://yoursite.com/llms.txt from an incognito window and confirm a 200 with your content.
Four file-hygiene mistakes
- Wrong location. The proposal defines the root path; a subdirectory file is outside that convention.
- Listing dead or noindexed URLs. Keep optional navigation files consistent with canonical live pages; do not infer an external ranking penalty from a mismatch.
- Serving HTML. A 404 page returning 200, or a pretty "viewer" — content-type must be plain text/Markdown.
- Set-and-forget. A file describing your 2024 site map misleads about your 2026 one. Regenerate when your information architecture changes (the $9/mo re-audit alerts on drift).
Validate, then verify live
Paste your file into the validator (11 spec checks, instant), deploy, then run the full audit — it fetches the live file, scores structure, and compares listed URLs with your sitemap. Green checks mean the optional file passed CiteFuel's file-hygiene rubric, not that any engine consumed it or will cite the site.