Docusaurus tutorial · Static or generated · 6 minutes

How to Add llms.txt to Docusaurus

Docusaurus has no official llms.txt plugin yet — but it is one of the best-behaved frameworks for the format anyway. Everything in static/ is copied to your site root at build time, so a spec-compliant file is a 60-second job. For larger docs, a community plugin generates llms.txt and llms-full.txt from your actual pages. Both routes are covered here.

Why Docs Sites Are llms.txt's Best Use Case

The llms.txt convention exists so AI engines, chatbots and coding agents can find the pages that answer their questions without crawling an entire site. Documentation is the content type where that matters most: docs are factual, densely linked and constantly referenced in AI answers, yet their navigation is often sidebar-heavy and hostile to crawlers.

The docs-tooling world noticed early. The llmstxt.org integrations list includes Mintlify, which generates an llms.txt and Markdown page versions for every site it hosts, and GitBook, which serves the file for published docs. Real-world adopters include dub.co (via Mintlify) and Cloudflare's developer docs (via a build script). Docusaurus, used by React, Jest and thousands of open-source projects, has no native option yet — an official plugin proposal has sat as an open feature request in the facebook/docusaurus repo since February 2025. In practice you do not need to wait for it.

Method 1: A Hand-Written File in static/ (60 Seconds)

Docusaurus treats docs/ as content and static/ as assets: every file in static/ is copied verbatim to the output root on every build. That is the entire mechanism — create static/llms.txt and follow the v2 spec structure:

# Acme Docs

> Acme Docs is the official documentation for the Acme platform.
> It covers installation, configuration, the REST API and troubleshooting.

## Getting Started

- [Quickstart](https://acme.com/docs/quickstart): first project in five minutes
- [Authentication](https://acme.com/docs/auth): API keys and access tokens
- [Deployment](https://acme.com/docs/deploy): production setup for self-hosting

## API Reference

- [REST API](https://acme.com/docs/api): every endpoint, parameter and error
- [Webhooks](https://acme.com/docs/webhooks): events your server can subscribe to

Build with npm run build and the file lands at the root of build/, ready for Netlify, Vercel, Cloudflare Pages or any static host. Keep this method when your information architecture changes rarely. The file must point to canonical pages with absolute URLs — never relative paths, which agents resolve inconsistently.

Method 2: Generate llms.txt and llms-full.txt From Your Docs

For a file that stays in sync with a growing sidebar, the community plugin docusaurus-plugin-llms (MIT-licensed and listed on llmstxt.org) walks your docs at build time. With no options it writes a curated table of contents to llms.txt and combines the full text of every page into llms-full.txt:

// docusaurus.config.js
const config = {
  // ... your existing config ...
  plugins: [
    'docusaurus-plugin-llms',
  ],
};

export default config;

The plugin is designed for exactly the situations a static file cannot handle: versioned docs (each version can emit its own file, such as /stable/llms.txt), custom LLM files for specific audiences, and large references where a full-text dump saves an agent dozens of requests. If your reference section is deep, link the generated dump the way the llms.txt vs llms-full.txt guide describes.

The Docusaurus Checklist

Verify Before Agents Do

After deploying, confirm the file serves with a 200 status and a text content type:

curl -s -o /dev/null -w "%{http_code} %{content_type}\n" https://your-domain.com/llms.txt
# Expect: 200 text/plain

Docusaurus serves the file from the same CDN edge as your docs, so check the version you actually deployed — a stale build is the most common reason an llms.txt goes missing after a redesign. Then paste the URL into the free llms.txt checker to validate the H1, the blockquote summary and the section structure.

Draft the initial file in seconds by feeding your sitemap into the free llms.txt generator, then verify the output with the checker before you wire up the plugin. Documentation sites are the highest-leverage place an llms.txt can live — a correct, current file is cheap insurance that your docs are the version AI engines read.