How to add llms.txt to a Nuxt site

Nuxt has no built-in llms.txt. Put the file in public/, serve it from a server route, or install the community nuxt-llms module, then check the header.

Nuxt · llms.txt · Not built in

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)

  1. Write the file in the llms.txt format: an H1 title, a one-line blockquote summary, then ## sections of links.
  2. Save it as public/llms.txt. The docs say files in public/ "are served at the root and are not modified by the build process".
  3. Deploy.

Option B: server route (for generated content)

  1. Create server/routes/llms.txt.ts. Files in server/routes get no /api prefix, 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.
  2. 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
})
  1. If you deploy with nuxt generate, add the route to prerender.routes. The crawler follows links only, and the docs use the same setting for /sitemap.xml and /robots.txt. Without it, our test build had no llms.txt in .output/public.
// nuxt.config.ts
export default defineNuxtConfig({
  prerender: { routes: ['/llms.txt'] },
})

Option C: the community nuxt-llms module

  1. Run npm i nuxt-llms.
  2. Add 'nuxt-llms' to modules and set llms.domain (required), title, description and sections in nuxt.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.html and 404.html SPA fallbacks. If your host serves 200.html for unknown paths, a missing /llms.txt can return the app shell with a 200. In our test, a server build of an app with only app.vue did 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, ...) with event.res.headers.set(...). From Nuxt 4.6 you can import defineEventHandler from nuxt/server and use the new style. Do not mix the two styles in one file. We could not verify that the dotted .txt file name works on Nuxt 5.
  • Reach. llms.txt mostly 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.

How common is it on Nuxt?

Among 24 measured Nuxt sites, the median w2agent Score is 51/100.

  • llms.txt exists: 83% of 24 Nuxt sites pass
  • llms.txt follows spec: 95% of 20 Nuxt sites pass
  • llms.txt links resolve: 65% of 20 Nuxt sites pass

Latest audit of each measured site. Sites where a check did not apply are left out.

Related checks

Check it

Test your file with the llms.txt validator.

Check your own site →

Sources

Verified against these sources on