<!-- Generated from zh/llms-txt-docusaurus/index.html. The canonical document is the HTML page. -->

- [ 首页 ](/zh/) 
/
- [ 如何创建 llms.txt ](/zh/how-to-create/) 
/
- Docusaurus            
# Docusaurus 中的 `llms.txt`

文档网站非常适合使用 llms.txt。在 Docusaurus 中，只需在 static/ 中放置一个文件。

最近更新: 2026年7月26日

本页内容

- [ 文件的放置位置 ](#overview)
- [ 方法：static/ 文件夹 ](#static)
- [ 注意 baseUrl ](#baseurl)
- [ 验证设置 ](#verify)            
## 文件放在哪里

Docusaurus 会复制 `static/` 目录复制到构建后网站的根目录。 位于 `static/llms.txt` 由 `/llms.txt`。由于 Docusaurus 用于文档， `llms.txt` 来映射您的关键文档页面，对
AI 助手尤其有价值。

保持文件简短且经过审慎筛选。应将助手引向概览页、API 参考、
带版本的文档、变更日志和支持政策，而不是侧边栏中的每个条目。如果文档使用 非根路径 `baseUrl`，请在公布该文件之前验证构建路径和公开网址。

## 方法：static/ 文件夹

- 添加文件： `touch static/llms.txt` 
- 列出最有用的文档页面（参阅 [操作指南](/zh/how-to-create/)):   
```
# Your Project Docs

> Documentation for Your Project: guides, API reference, and tutorials.

## Guides

- [Getting started](https://yourdomain.com/docs/intro): installation and first steps.
- [Configuration](https://yourdomain.com/docs/config): all options explained.

## Reference

- [API reference](https://yourdomain.com/docs/api): full endpoint catalog.

```

- 构建并部署： `npm run build`.   
## 注意 baseUrl

警告

非根路径 baseUrl 会改变文件路径

如果  docusaurus.config.js  设置了一个  baseUrl  以外的值  /  （GitHub
Pages 项目网站常见，例如  /my-project/ ），您的文件将通过以下路径提供：
/my-project/llms.txt ，而不是  /llms.txt 。AI 爬虫会在
域名根路径查找该文件，因此优先使用根  baseUrl  （自定义域名）或通过你的主机在 真实根路径提供该文件。

## 验证设置

```
curl -sI https://yourdomain.com/llms.txt | grep -i content-type
# expect: content-type: text/plain
```

在 GitHub Pages 上托管文档？请参阅 [GitHub Pages 指南](/zh/llms-txt-github-pages/) ，了解
根路径注意事项。若要添加完整内容版本，请添加
[`llms-full.txt`](/zh/llms-full-txt/)，然后使用以下工具检查两者：
[验证器](/zh/validator/).

## 来源

- [ Docusaurus 文档，静态资源 ](https://docusaurus.io/docs/static-assets)
- [ llmstxt.org，规范参考 ](https://llmstxt.org/)
