This plugin automatically generates LLMS text files (llms.txt
and llms-full.txt
) for VitePress projects. It can be used to create useful metadata files and provide structured information for large language models (LLMs).
- Generate
llms.txt
for each page andllms-full.txt
with all content. - Supports custom frontmatter addition.
- Supports transformation of page data via a callback.
- Option to build only the
llms-full.txt
file. - Generates an index table of contents if configured.
Install the plugin:
npm install vitepress-plugin-llmstxt
# or
pnpm install vitepress-plugin-llmstxt
# or
yarn add vitepress-plugin-llmstxt
# or
bun add vitepress-plugin-llmstxt
# or
deno add vitepress-plugin-llmstxt
Import and use the plugin in your VitePress configuration:
import { defineConfig } from 'vitepress';
import llmstxtPlugin from 'vitepress-plugin-llmstxt';
export default defineConfig({
vite: {
plugins: [llmstxtPlugin()],
},
});
The plugin supports the following configuration options:
The base URL to use for generated links. Defaults to the server's origin.
An array of glob patterns to exclude from processing.
An array of glob patterns to search for markdown files.
If true
, only the llms-full.txt
file will be generated.
If true
, adds an index table of contents to the generated file.
A callback to transform each page's data.
import { defineConfig } from 'vitepress';
import llmstxtPlugin from 'vitepress-plugin-llmstxt';
export default defineConfig({
vite: {
plugins: [llmstxtPlugin({
hostname: 'https://example.com',
ignore: ['drafts/**/*'],
onlyFull: false,
indexTOC: true,
transform: ({ page, pages }) => {
if ( page.path === '/llms.txt' )
page.content = `Structured information designed to provide useful metadata to large language models (LLMs)\n\n` + page.content
return page
}
})],
},
});
GPL-3.0