LLMs Integration
Docus integrates nuxt-llms by default to prepare your content for Large Language Models (LLMs). All your documentation pages are injected and /llms.txt and /llms-full.txt files are automatically generated and pre-rendered.
Defaults
Here are the default values use to generate the /llms.txt file:
domain→ computed based on your deployment platform (or by usingNUXT_SITE_URLenv variable)title→ extracted from yourpackage.jsondescription→ extracted from yourpackage.jsonfull.title→ extracted from yourpackage.jsonfull.description→ extracted from yourpackage.json
Customize
You can override your LLMs data from the nuxt.config.ts :
export default defineNuxtConfig({
llms: {
domain: 'https://your-site.com',
title: 'Your Site Name',
description: 'A brief description of your site',
full: {
title: 'Your Site Name',
description: 'A brief description of your site',
},
},
})
Guiding agents
Your pages tell an agent what your product does. They rarely tell it when to reach for you, which is what an agent needs before recommending you. Two options cover that:
sectionsadds a group of links on top of the generated page list, for resources that live outside your content (a repository, a package, an API reference)notesadds a## Notesblock at the end of the document, the right place for when-to-use guidance
export default defineNuxtConfig({
llms: {
domain: 'https://your-site.com',
sections: [
{
title: 'Developer Resources',
description: 'Machine-readable entry points for this documentation.',
links: [
{ title: 'Source on GitHub', description: 'Issues and releases.', href: 'https://github.com/your-org/your-repo' },
],
},
],
notes: [
'When to use this library: you are building X and want Y.',
'This library is not a replacement for Z. For that, use W instead.',
'Reading this documentation as an agent: append `.md` to any page URL, or send `Accept: text/markdown`.',
],
},
})
Agent-friendly 404s
Instead of replying with a JSON error body, Docus replies with a short markdown document, listing the machine-readable entry points your site actually serves:
curl -H "Accept: text/markdown" https://docus.dev/en/does-not-exist
# 404 — Page not found
`/en/does-not-exist` was not found on this site.
## Where to look next
- [/llms.txt](/llms.txt): index of Docus
- [/llms-full.txt](/llms-full.txt): the full content of this site as a single markdown document
- [/sitemap.xml](/sitemap.xml): every page, with its last modification date
- [/.well-known/skills/index.json](/.well-known/skills/index.json): agent skills published by this site
- [/](/): home page
The skills entry only appears when your site publishes skills, and /llms-full.txt only when it is enabled, so the document never points at a route that does not exist.
The response keeps the 404 status and is served as text/markdown; charset=utf-8 with Vary: Accept, so CDNs never mix it up with the HTML variant.
Only clients that clearly aren't rendering HTML get this document. Untouched:
- Browsers: any request accepting
text/htmlstill renders the theme error page - API clients: requests accepting
application/json, or targeting/api/**and*.json, keep the default JSON error body fetch()and$fetch: browser-initiated requests keep the default JSON error body, soerror.datastays parseable- Assets: a missing script, style, image or feed keeps the default error body, since markdown would be meaningless there
To restore the default error body:
export default defineNuxtConfig({
docus: {
notFound: false,
},
})
Raw Markdown Access
When nuxt-llms is enabled, Docus also exposes a raw markdown endpoint so AI agents can fetch LLM-ready source files without going through the full rendering pipeline. This reduces token usage and improves response speed for AI-powered tools consuming your documentation.
How it works
- Endpoint:
/raw/<content-path>.md— use the same path as the page URL, drop trailing/index, and keep the.mdextension - Content-Type:
text/markdown; charset=utf-8 - Auto-enrichment: if the requested document is missing a top-level heading or description, the route automatically prepends the title and description to the markdown body
- LLMs.txt integration: document links in
llms.txtare automatically rewritten to the/raw/...mdendpoint, so agents fetch compact markdown instead of full HTML
Configuration
You can customize the raw markdown behavior from your nuxt.config.ts:
export default defineNuxtConfig({
llms: {
contentRawMarkdown: {
// Prevent specific page collections from being exposed
excludeCollections: ['landing', 'landing_en', 'landing_fr'],
// Keep llms.txt links pointing to rendered pages instead of raw markdown
rewriteLLMSTxt: false,
},
},
})
To disable raw markdown access entirely:
export default defineNuxtConfig({
llms: {
contentRawMarkdown: false,
},
})
Markdown Redirection
When deployed on Vercel, Docus automatically configures intelligent routing to serve markdown content to AI agents and CLI tools.
Why?
Agents like Claude Code use Accept: text/markdown headers by default, retuning raw Markdown is saving lots of data transfer and tokens in the process.
How?
Docus detects requests from AI agents and command-line tools using HTTP headers:
- Accept header: Requests with
Accept: text/markdownare automatically redirected - User-agent detection:
curlrequests as agents are automatically redirected
Redirect Rules
- Root path:
/→/llms.txt - Documentation pages:
/{path}→/raw/{path}.md
Example Usage
# Get llms.txt from homepage
curl -H "Accept: text/markdown" https://docus.dev/
# Get llms.txt from locale homepage
curl -H "Accept: text/markdown" https://docus.dev/en
# Get raw markdown for a documentation page
curl -H "Accept: text/markdown" https://docus.dev/en/ai/llms
All these commands will return markdown content instead of HTML.
Caching
The same URL answers in HTML or markdown depending on the request, so every response carries Vary: Accept, User-Agent. Without it a CDN could serve the HTML variant to an agent asking for markdown, or the reverse, depending on which one landed in the cache first.
curl -sI -H "Accept: text/markdown" https://docus.dev/en/ai/llms | grep -i vary
# vary: Accept, User-Agent