|
| 1 | +--- |
| 2 | +title: llms.txt |
| 3 | +icon: file-text |
| 4 | +description: Automatic LLM-friendly content indexing for your documentation |
| 5 | +--- |
| 6 | + |
| 7 | +# llms.txt |
| 8 | +:::subtitle |
| 9 | +Make your documentation easier for LLMs to read and index |
| 10 | +::: |
| 11 | + |
| 12 | +The [llms.txt file](https://llmstxt.org) is an emerging standard that helps Large Language Models (LLMs) index content more efficiently, similar to how a sitemap helps search engines. AI tools can use this file to understand your documentation structure and find content relevant to user queries. |
| 13 | + |
| 14 | +Your documentation automatically generates an `llms.txt` file at the root of your site that lists all available pages. This file is always up to date and requires zero maintenance. |
| 15 | + |
| 16 | +View your `llms.txt` by visiting `/llms.txt` at your documentation site's URL. |
| 17 | + |
| 18 | +## How it works |
| 19 | + |
| 20 | +The system automatically: |
| 21 | + |
| 22 | +1. **Scans all markdown files** in your documentation |
| 23 | +2. **Extracts frontmatter** (title and description) from each page |
| 24 | +3. **Generates a structured list** of all pages with their URLs |
| 25 | +4. **Hosts the file** at `/llms.txt` |
| 26 | + |
| 27 | +## llms.txt structure |
| 28 | + |
| 29 | +An `llms.txt` file is a plain Markdown file that contains: |
| 30 | + |
| 31 | +- **Site title** as an H1 heading |
| 32 | +- **Structured content sections** with links and descriptions for each page |
| 33 | + |
| 34 | +Each page's description comes from the `description` field in its frontmatter. Pages without a `description` field appear in the `llms.txt` file with just their title. |
| 35 | + |
| 36 | +Example llms.txt: |
| 37 | + |
| 38 | +```md [desc="This structured approach allows LLMs to efficiently process your documentation at a high level and locate relevant content for user queries."] |
| 39 | +# My Documentation Site |
| 40 | + |
| 41 | +## Documentation |
| 42 | + |
| 43 | +- [Getting Started](https://example.com/docs/getting-started): Quick start guide for new users |
| 44 | +- [API Reference](https://example.com/docs/api): Complete API endpoint documentation |
| 45 | +- [Configuration](https://example.com/docs/config): Configuration options and settings |
| 46 | +``` |
| 47 | + |
| 48 | +## Reference |
| 49 | +::atlas{apiRefItemKind="secondary" references="@uniform('@core/types/settings.ts', {mini: 'LLMsTxt'})"} |
| 50 | + |
| 51 | +## Configuration |
| 52 | + |
| 53 | +### Automatic generation |
| 54 | + |
| 55 | +By default, `llms.txt` is automatically generated from your markdown files. No configuration needed. |
| 56 | + |
| 57 | +### Custom baseUrl |
| 58 | + |
| 59 | +To include full URLs in your `llms.txt` file, configure the `baseUrl` in your settings: |
| 60 | + |
| 61 | +```json [desc="This will generate URLs like <code>https://docs.example.com/docs/getting-started</code> instead of relative paths like <code>/docs/getting-started</code>."] |
| 62 | +{ |
| 63 | + "ai": { |
| 64 | + "llmsTxt": { |
| 65 | + "title": "My Documentation", |
| 66 | + "baseUrl": "https://docs.example.com" |
| 67 | + } |
| 68 | + } |
| 69 | +} |
| 70 | +``` |
| 71 | + |
| 72 | + |
| 73 | +### Customization |
| 74 | + |
| 75 | +You have four options for customizing your `llms.txt`: |
| 76 | + |
| 77 | +**Option 1: Custom sections** |
| 78 | + |
| 79 | +```json |
| 80 | +{ |
| 81 | + "ai": { |
| 82 | + "llmsTxt": { |
| 83 | + "sections": { |
| 84 | + "Gettting Started": { |
| 85 | + "title": "Getting Started", |
| 86 | + "url": "https://docs.example.com/getting-started", |
| 87 | + "description": "Quick start guide for new users" |
| 88 | + } |
| 89 | + } |
| 90 | + } |
| 91 | + } |
| 92 | +} |
| 93 | +``` |
| 94 | + |
| 95 | +**Option 2: Custom file** |
| 96 | + |
| 97 | +Create an `llms.txt` file at the root of your project. This completely overrides the auto-generated file: |
| 98 | + |
| 99 | +```txt [desc="Your custom file must include a site title as an H1 heading. See the [llms.txt format specification](https://llmstxt.org/#format) for best practices."] |
| 100 | +project-root/ |
| 101 | + ├── llms.txt ← Your custom file |
| 102 | + ├── docs/ |
| 103 | + └── settings.ts |
| 104 | +``` |
| 105 | + |
| 106 | +**Option 3: Custom path to a file** |
| 107 | + |
| 108 | +Reference a custom markdown file in your settings: |
| 109 | + |
| 110 | +```json |
| 111 | +{ |
| 112 | + "ai": { |
| 113 | + "llmsTxt": "./path/to/custom-llms.txt" |
| 114 | + } |
| 115 | +} |
| 116 | +``` |
| 117 | + |
| 118 | +**Option 4: Inline markdown** |
| 119 | + |
| 120 | +Provide markdown content directly in your settings: |
| 121 | + |
| 122 | +```json |
| 123 | +{ |
| 124 | + "ai": { |
| 125 | + "llmsTxt": "# My Custom Documentation \n\n ## Documentation \n - [Getting Started](/getting-started): Quick start guide" |
| 126 | + } |
| 127 | +} |
| 128 | +``` |
| 129 | + |
| 130 | +## Benefits for AI tools |
| 131 | + |
| 132 | +The `llms.txt` file helps AI assistants like Claude, ChatGPT, and others: |
| 133 | + |
| 134 | +- **Discover available documentation** quickly without crawling |
| 135 | +- **Understand content structure** at a high level |
| 136 | +- **Find relevant pages** for specific user queries |
| 137 | +- **Provide accurate answers** with proper context |
| 138 | + |
| 139 | +This improves the accuracy and speed of AI-assisted documentation searches and support. |
| 140 | + |
| 141 | +## Disabling llms.txt |
| 142 | + |
| 143 | +To disable automatic `llms.txt` generation, set it to `false` in your settings: |
| 144 | + |
| 145 | +```json |
| 146 | +{ |
| 147 | + "ai": { |
| 148 | + "llmsTxt": false |
| 149 | + } |
| 150 | +} |
| 151 | +``` |
| 152 | + |
| 153 | +## Related resources |
| 154 | + |
| 155 | +- [llms.txt specification](https://llmstxt.org) - Official format documentation |
| 156 | +- [Why llms.txt matters](https://llmstxt.org/#why) - Understanding the standard |
0 commit comments