What Nuxt does today
Nuxt does not create an llms.txt for your site. The nuxt.com docs publish their own /llms.txt, but that file describes Nuxt itself. It is not a framework feature.
The Nuxt module directory lists nuxt-llms, which generates the file. The directory labels it a community module, not part of Nuxt. This guide targets Nuxt 4, the current major version.
Add llms.txt to Nuxt
Option A: static file (simplest)
- Write the file in the llms.txt format: an H1 title, a one-line blockquote summary, then
##sections of links. - Save it as
public/llms.txt. The docs say files inpublic/"are served at the root and are not modified by the build process". - Deploy.
Option B: server route (for generated content)
- Create
server/routes/llms.txt.ts. Files inserver/routesget no/apiprefix, so this answers/llms.txt. The dotted file name is a pattern we tested on Nuxt 4.6.1. The Nuxt docs do not show one. - Set the content type. In our test, a route that returned a string without this line was served as
text/html.
// server/routes/llms.txt.ts
export default defineEventHandler(async (event) => {
const text = await buildLlmsTxt() // your function
setResponseHeader(event, 'content-type', 'text/plain; charset=utf-8')
return text
})
- If you deploy with
nuxt generate, add the route toprerender.routes. The crawler follows links only, and the docs use the same setting for/sitemap.xmland/robots.txt. Without it, our test build had nollms.txtin.output/public.
// nuxt.config.ts
export default defineNuxtConfig({
prerender: { routes: ['/llms.txt'] },
})
Option C: the community nuxt-llms module
- Run
npm i nuxt-llms. - Add
'nuxt-llms'tomodulesand setllms.domain(required),title,descriptionandsectionsinnuxt.config.ts.
The module's README says it generates and prerenders /llms.txt. It builds the file from that config and from runtime hooks, for example from Nuxt Content. It does not read your pages by itself. We did not run the module.
Use one option. In our test, a file in public/ was served before a server route at the same path, so the route never ran.
Check that it works
Run curl -sI https://your-site.com/llms.txt after you deploy. You want a 200 status and a text/plain content type. The docs do not state the content type for public/ files. In our test they returned text/plain. A static host decides the type for a prerendered file, so check it on your host.
Then run the llms.txt exists check against your domain, or paste the file into the llms.txt validator.
Limits and workarounds
- Soft 404s. Static builds write
200.htmland404.htmlSPA fallbacks. If your host serves200.htmlfor unknown paths, a missing/llms.txtcan return the app shell with a 200. In our test, a server build of an app with onlyapp.vuedid the same. The audit treats that HTML page as a missing file, so confirm the real file is deployed. - Nuxt 5. Nuxt 5 is in development. The upgrade guide replaces
setResponseHeader(event, ...)withevent.res.headers.set(...). From Nuxt 4.6 you can importdefineEventHandlerfromnuxt/serverand use the new style. Do not mix the two styles in one file. We could not verify that the dotted.txtfile name works on Nuxt 5. - Reach.
llms.txtmostly helps coding agents and tools that fetch documentation, not Google or chat-assistant visibility. Link to it from your docs so agents can find it.