Package Exports
- @writechoice/docusaurus-plugin-llms-txt
Readme
@writechoice/docusaurus-plugin-llms-txt
Docusaurus plugin that makes your documentation AI-readable at build time.
- Generates
/llms.txt— a structured index of all your pages following the llms.txt spec - Generates
/llms-full.txt— all doc content merged into a single file in sidebar order - Serves every doc page as raw Markdown at
/{path}.md - Injects a
<link rel="alternate" type="text/plain" href="/llms.txt">tag into every page - Optional
_worker.jsfor Cloudflare Pages to handleAccept: text/markdowncontent negotiation
Installation
npm install @writechoice/docusaurus-plugin-llms-txtUsage
// docusaurus.config.js
export default {
plugins: ['@writechoice/docusaurus-plugin-llms-txt'],
};With options
export default {
plugins: [
[
'@writechoice/docusaurus-plugin-llms-txt',
{
generateLlmsTxt: true,
generateMarkdownFiles: true,
generateLlmsFullTxt: true,
description: 'API documentation for My Platform',
deployTarget: 'cloudflare',
},
],
],
};Options
| Option | Type | Default | Description |
|---|---|---|---|
generateLlmsTxt |
boolean |
true |
Write /llms.txt to the build output |
generateMarkdownFiles |
boolean |
true |
Write /{permalink}.md for each doc |
generateLlmsFullTxt |
boolean |
true |
Write /llms-full.txt with all docs merged |
description |
string |
'' |
Summary line in llms.txt (falls back to site tagline, then title) |
deployTarget |
string|null |
null |
Set to 'cloudflare' to generate a _worker.js for content negotiation |
What gets generated
/llms.txt
A plain-text index organized by sidebar section:
# My Site
> API documentation for My Platform
## Getting Started
- [Introduction](/getting-started.md): Overview of the platform
- [Authentication](/authentication.md): How to authenticate
## API Reference
- [Endpoints](/api/endpoints.md)/{permalink}.md
Each doc page is available as clean Markdown (frontmatter stripped, # Title prepended):
GET /docs/introduction.md → # Introduction\n\nContent here.../llms-full.txt
All docs concatenated in sidebar order, separated by ---, for feeding entire documentation to an LLM in one request.
Cloudflare Pages worker
When deployTarget: 'cloudflare' is set, a _worker.js is written to the build output. It intercepts requests with Accept: text/markdown and serves the pre-built .md file, enabling standard HTTP content negotiation.
Compatibility
| Docusaurus | Node |
|---|---|
| >= 3.0.0 | >= 18 |
Companion package
This plugin handles the build side — generating the files. To give users a Copy page button in the UI that lets them copy Markdown, open the page in ChatGPT or Claude, or view the raw .md directly, install the companion theme package:
npm install @writechoice/docusaurus-theme-llms-txtTogether they cover the full AI-readiness stack: the plugin makes your content machine-readable, the theme gives users the tools to use it.
See @writechoice/docusaurus-theme-llms-txt for setup instructions.
License
MIT