Skip to content

Commit 1f6458c

Browse files
authored
Merge pull request #84 from livesession/feat/llms.txt
feat(llms.txt): llms.txt impl
2 parents 6675456 + 398c3d6 commit 1f6458c

17 files changed

Lines changed: 4549 additions & 2559 deletions

File tree

apps/docs/docs.json

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -303,10 +303,9 @@
303303
]
304304
},
305305
{
306-
"group": "SDK Generation",
306+
"group": "AI",
307307
"pages": [
308-
"docs/guides/sdk-quickstart",
309-
"docs/guides/opensdk"
308+
"docs/guides/llms-txt"
310309
]
311310
},
312311
{
@@ -360,6 +359,13 @@
360359
}
361360
]
362361
},
362+
{
363+
"group": "SDK Generation",
364+
"pages": [
365+
"docs/guides/sdk-quickstart",
366+
"docs/guides/opensdk"
367+
]
368+
},
363369
{
364370
"group": "Development",
365371
"pages": [

apps/docs/docs/guides/llms-txt.md

Lines changed: 156 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,156 @@
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

apps/docs/public/docs.json

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,28 @@
22
"$schema": "http://json-schema.org/draft-07/schema#",
33
"additionalProperties": false,
44
"definitions": {
5+
"AI": {
6+
"additionalProperties": false,
7+
"description": "AI configuration",
8+
"properties": {
9+
"llmsTxt": {
10+
"anyOf": [
11+
{
12+
"const": false,
13+
"type": "boolean"
14+
},
15+
{
16+
"$ref": "#/definitions/LLMsTxt"
17+
},
18+
{
19+
"$ref": "#/definitions/llmsTxtString"
20+
}
21+
],
22+
"description": "LLMs txt configuration"
23+
}
24+
},
25+
"type": "object"
26+
},
527
"API": {
628
"additionalProperties": false,
729
"description": "API Docs configuration interface",
@@ -1190,6 +1212,71 @@
11901212
],
11911213
"type": "object"
11921214
},
1215+
"LLMsTxt": {
1216+
"additionalProperties": false,
1217+
"description": "LLMs txt configuration",
1218+
"properties": {
1219+
"baseUrl": {
1220+
"description": "Base URL of the LLMs txt",
1221+
"type": "string"
1222+
},
1223+
"sections": {
1224+
"$ref": "#/definitions/LLMsTxtSectionMap",
1225+
"description": "Sections of the LLMs txt"
1226+
},
1227+
"summary": {
1228+
"description": "Description of the LLMs txt",
1229+
"type": "string"
1230+
},
1231+
"title": {
1232+
"description": "Title of the LLMs txt",
1233+
"examples": [
1234+
"LLMs txt"
1235+
],
1236+
"type": "string"
1237+
}
1238+
},
1239+
"required": [
1240+
"title",
1241+
"baseUrl"
1242+
],
1243+
"type": "object"
1244+
},
1245+
"LLMsTxtSectionMap": {
1246+
"additionalProperties": {
1247+
"additionalProperties": false,
1248+
"properties": {
1249+
"description": {
1250+
"description": "Description of the section",
1251+
"examples": [
1252+
"Description of section 1"
1253+
],
1254+
"type": "string"
1255+
},
1256+
"title": {
1257+
"description": "Title of the section",
1258+
"examples": [
1259+
"Section 1"
1260+
],
1261+
"type": "string"
1262+
},
1263+
"url": {
1264+
"description": "URL of the section",
1265+
"examples": [
1266+
"https://www.example.com"
1267+
],
1268+
"type": "string"
1269+
}
1270+
},
1271+
"required": [
1272+
"title",
1273+
"url",
1274+
"description"
1275+
],
1276+
"type": "object"
1277+
},
1278+
"type": "object"
1279+
},
11931280
"Logo": {
11941281
"additionalProperties": false,
11951282
"description": "Logo configuration interface",
@@ -2304,6 +2391,10 @@
23042391
}
23052392
},
23062393
"type": "object"
2394+
},
2395+
"llmsTxtString": {
2396+
"description": "LLMs txt as a path to a file or a llms.txt content",
2397+
"type": "string"
23072398
}
23082399
},
23092400
"description": "Main settings interface for the application",
@@ -2312,6 +2403,10 @@
23122403
"$ref": "#/definitions/Advanced",
23132404
"description": "Advanced configuration"
23142405
},
2406+
"ai": {
2407+
"$ref": "#/definitions/AI",
2408+
"description": "AI configuration"
2409+
},
23152410
"api": {
23162411
"$ref": "#/definitions/API",
23172412
"description": "API Docs configuration"

0 commit comments

Comments
 (0)