Docusaurus 中的 llms.txt

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

最近更新:

文件放在哪里

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

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

方法:static/ 文件夹

  1. 添加文件: touch static/llms.txt
  2. 列出最有用的文档页面(参阅 操作指南):
# 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.
  1. 构建并部署: npm run build.

注意 baseUrl

验证设置

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

在 GitHub Pages 上托管文档?请参阅 GitHub Pages 指南 ,了解 根路径注意事项。若要添加完整内容版本,请添加 llms-full.txt,然后使用以下工具检查两者: 验证器.

来源