How to Add llms.txt to Nuxt
Nuxt ships no llms.txt output of its own — but its
public/ directory makes Nuxt apps one of the easiest to fix:
a static file in 60 seconds, a server/routes/ handler for a
live-generated file, or the official
nuxt-llms module for build-time
llms.txt and llms-full.txt. Nuxt's own
documentation site, curl-verified for this guide, shows what a good file
looks like.
The Nuxt Rule That Makes This Easy
Nuxt serves every file inside public/ at the site root,
untouched by the build — the same mechanism that publishes
robots.txt and favicon.ico (the directory was
called static/ in Nuxt 2). That one rule means an
llms.txt file on disk becomes your live
/llms.txt with zero routes, zero config and zero plugins.
There is no native Nuxt convention beyond it, so your choice is really
about how much of the file you want to maintain by hand.
Method 1: A Static public/llms.txt in 60 Seconds
Create the file and publish — the whole setup is one command and one edit. A spec-compliant file needs only an H1; add a summary and grouped link lists for the context AI agents need:
# Acme Docs
> Acme Docs covers the Acme API: REST reference, SDKs and step-by-step tutorials.
## Essentials
- [Quickstart](https://acme.com/docs/quickstart): first API call in five minutes
- [API Reference](https://acme.com/api): every endpoint, error and rate limit
- [Guides](https://acme.com/docs/guides): auth, webhooks and data models
## Optional
- [Changelog](https://acme.com/changelog): what changed in each release
Links must be absolute URLs, and every entry benefits from a short
description — the same rules as the full
llms.txt format guide.
A second file named public/llms-full.txt gives agents the
full-text sibling; see
llms.txt vs llms-full.txt
for when that pays off. The cost of this route is maintenance: every new
page is a hand edit, and a file that drifts from your content is one
agents follow into stale territory.
Real-World Case: nuxt.com/llms.txt
The Nuxt project dogfoods the format. On 2026-09-09 the official docs
site served a 58,277-byte file at /llms.txt:
$ curl -s -o /dev/null -w "HTTP %{http_code}, %{size_download} bytes\n" https://nuxt.com/llms.txt
HTTP 200, 58277 bytes
The file itself is a good model for a framework site. It opens with the
# Nuxt Docs H1 and a blockquote that states exactly when the
docs should be used. Then it links
nuxt.com/llms-full.txt (the whole documentation in one
file), advertises per-page Markdown — append .md to any URL
or send Accept: text/markdown — and points agents at a
public MCP server under /mcp. Clean Markdown and
llms-full.txt matter enough to both
the v2 spec
and Nuxt's own file.
Method 2: Generate It on the Fly with server/routes/
For content that changes faster than your deploy cadence, serve the file
from a Nitro route. Nuxt maps server/routes/llms.txt.get.ts
to /llms.txt — server routes outside
server/api/ get no /api prefix — and
auto-imports defineEventHandler. Query Nuxt Content or your
CMS and return plain text:
// server/routes/llms.txt.get.ts
const header = '# Acme Docs\n\nDocumentation for the Acme API and SDKs.\n\n## Documentation\n\n'
export default defineEventHandler(async () => header + (await getPages()).join('\n'))
Return a string and Nitro serves it as text; return a
Response to set the Content-Type header
explicitly. Every request rebuilds the file, so a new CMS entry is
reflected instantly with no redeploy — at the cost of a query per
request, which is why build-time generation is the better default for
most sites.
Method 3: nuxt-llms — Build-Time llms.txt and llms-full.txt
nuxt-llms,
maintained by NuxtLabs and published on npm since February 2025 (v0.2.0,
January 2026), generates and prerenders /llms.txt at build
time from a small nuxt.config.ts block:
# terminal
npm i nuxt-llms
// nuxt.config.ts
export default defineNuxtConfig({
modules: ['nuxt-llms'],
llms: {
domain: 'https://acme.com',
title: 'Acme Docs',
description: 'API reference and guides for the Acme platform.',
sections: [{ title: 'Guides', links: [{ title: 'Quickstart', href: '/docs/quickstart' }] }],
},
}) What you get for that config:
- llms.txt prerendered at build — set
prerender: falseto serve it dynamically instead (for example behind ISR). - llms-full.txt on demand — add a
full.titleandfull.descriptionand the module emits the second file too. - Runtime hooks —
llms:generatelets modules and server plugins push extra sections, so CMS content can extend the file. - Nuxt Content integration — with
@nuxt/content3.2.0 or newer, every file in yourcontent/directory is added tollms.txtandllms-full.txtautomatically.
Which One Should You Pick?
| Approach | Setup | Auto-updates | llms-full.txt | Best for |
|---|---|---|---|---|
| Static public/ file | 1 minute | No | Second file | Small, stable sites |
| server/routes handler | ~10 minutes | Every request | Your code | Content that changes between deploys |
| nuxt-llms module | ~5 minutes | Every build | Yes, via full option | Docs and Nuxt Content sites |
For a documentation site on Nuxt Content, the module is the clear winner: the file cannot drift, because the build writes it from the same content your pages render. Static suits a brochure site that rarely changes; a server route only earns its per-request cost when freshness beats the deploy interval.
Verify and Maintain
- Confirm the file is at the root —
public/llms.txt, neverpublic/llms/llms.txt. - Use absolute URLs and one descriptive line per link — see the llms.txt best practices guide.
- Check the deployed file after every deploy:
curl -s -o /dev/null -w "HTTP %{http_code}, %{content_type}\n" https://yoursite.com/llms.txt
# Expect: HTTP 200, text/plain Paste the URL into the free llms.txt checker, or feed your sitemap into the llms.txt generator for a first draft, then hand the maintenance to nuxt-llms — a zero-maintenance byproduct of the build that already publishes your Nuxt site.