Jekyll 中的 llms.txt
Jekyll 将任何不含 frontmatter 的文件视为静态文件。把 llms.txt 放入根目录,它就会原样发布。
最近更新:
文件放在哪里
Jekyll 会把任何以下划线或点开头之外、且没有 YAML front matter 的文件,直接复制到生成的 _site 目录,同时保留其路径。名为
llms.txt 位于项目根目录中的文件会提供于 /llms.txt.
方法:根目录中的静态文件
- 在仓库根目录创建文件:
touch llms.txt - 编写内容时不要使用 无前置元数据 (front matter 会使 Jekyll 尝试渲染它):
# Your Site Name
> One-sentence description of your site for LLM context.
## Core pages
- [Home](https://yourdomain.com/): what this site is about.
- [Blog](https://yourdomain.com/blog/): articles and updates.
- [About](https://yourdomain.com/about/): who maintains this site.
- 构建并部署:
bundle exec jekyll build.
下划线和点号开头的文件
Jekyll 会忽略以 _ 或 . 默认如此。这不会影响 llms.txt,但如果以后需要此类文件,必须将其添加到
include 列表中,位于 _config.yml:
# _config.yml
include:
- _example.txt
验证设置
curl -sI https://yourdomain.com/llms.txt | grep -i content-type
# expect: content-type: text/plain 许多 Jekyll 网站托管在 GitHub Pages 上,后者会从域名根目录提供该文件。请参阅 GitHub Pages 指南 了解该设置,并参阅 格式指南 以确保内容准确。