Package Exports
- hexo-plugin-llms
- hexo-plugin-llms/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (hexo-plugin-llms) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
hexo-plugin-llmstxt
一个 Hexo 插件,用于生成适合 LLMs (Large Language Models) 训练的文本文件。该插件会将你的博客文章转换为纯文本格式,并保存为易于处理的文件。
特性
- 生成包含文章摘要的
llms.txt文件 - 可选生成包含完整文章内容的
llms-full.txt文件 - 自动保存原始 Markdown 文件到 public/posts 目录
- 支持文章排序
- 自动过滤草稿文章
- 移除 Front-matter,保留纯文本内容
- 支持调试模式
安装
npm install hexo-plugin-llmstxt --save配置
在 Hexo 的 _config.yml 文件中添加以下配置(所有配置项都是可选的):
llmstxt:
generate_llms_full: false # 是否生成包含完整文章内容的文件
debug: false # 是否开启调试模式
postsHeader: "" # 文档标题,默认使用站点标题
description: "" # 文档描述,默认使用站点描述
sort: "desc" # 文章排序方式,可选 'desc' 或 'asc'配置说明
generate_llms_full: 设置为true时会生成llms-full.txt文件,包含所有文章的完整内容debug: 设置为true时会输出文件生成的详细日志postsHeader: 生成文件的标题,如果不设置则使用站点配置中的 titledescription: 生成文件的描述,如果不设置则使用站点配置中的 descriptionsort: 文章排序方式,desc为降序(新到旧),asc为升序(旧到新)
生成的文件
插件会在 public 目录下生成以下文件:
llms.txt: 包含所有文章的标题、链接和描述llms-full.txt: (可选)包含所有文章的完整内容posts/*.md: 所有文章的原始 Markdown 文件
文件格式示例
llms.txt 的格式如下:
# 站点标题
> 站点描述
## 文章列表
- [文章标题 1](链接1): 文章描述 1
- [文章标题 2](链接2): 文章描述 2llms-full.txt 的格式如下:
# 站点标题
> 站点描述
## 文章列表
## [文章标题 1](链接1)
文章 1 的完整内容...
## [文章标题 2](链接2)
文章 2 的完整内容...注意事项
- 插件会自动过滤掉标记为草稿的文章
- 生成的 Markdown 文件不包含 Front-matter
- 所有文章的原始 Markdown 文件会保存在
public/posts目录下 - 文章链接会自动从
.html转换为.md
License
MIT