Generate llms.txt related files for your Rspress site, allowing large language models to better understand your documentation site.
Add the following configuration to your configuration file:
Then execute the rspress build
command. While generating the output, the plugin will also generate llms.txt
, llms-full.txt
, and corresponding markdown files for each route in the output directory based on the navigation bar.
This plugin accepts an object parameter with the following type:
boolean | LlmsTxt
true
Whether to generate the llms.txt file, or to customize the llms.txt file through hooks.
The default format of an llms.txt file is as follows:
You can modify the specified part through hook.
onTitleGenerate
: Customize the generated title and description sections.onLineGenerate
: Customize each line of the md file.onAfterLlmsTxtGenerate
: Finally modify the contents of the llms.txt file.For example:
The corresponding generation results are:
boolean
true
Whether to generate a markdown file for the corresponding route, when set to false
, the markdown file for the corresponding route will not be generated.
boolean
true
Whether to generate the llms-full.txt file, the llms-full.txt
file will not be generated when set to false
.
(context: { page: PageIndexInfo }) => boolean
(context) => context.page.lang === config.lang
Whether to include certain pages when generated will only include pages corresponding to the default language by default, which is generally used to simplify llms.txt.
Generate llms.txt
and other related files for pages whose language is English only:
(context: { page: PageIndexInfo }) => boolean
undefined
Whether to exclude certain pages, it will be executed after include
.
Exclude a single page under the /foo
route: