Generate /llms.txt for your documentation website on VitePress

Hello π, I want to share with you about a new plugin vitepress-plugin-llms
which automatically generates documentation for LLMs for websites based on VitePress
Large language models increasingly rely on website information, but face a critical limitation: context windows are too small to handle most websites in their entirety. Converting complex HTML pages with navigation, ads, and JavaScript into LLM-friendly plain text is both difficult and imprecise.
https://llmstxt.org suggests using the /llms.txt file on the websites with general information and a table of contents for LLMs
It should look something like this:
# Title
> Optional description goes here
Optional details go here
## Section name
- [Link title](https://link_url): Optional link details
## Optional
- [Link title](https://link_url)
Raw documentation in Markdown format is much lighter and does not require further processing, such documentation will help LLMs with internet access to process documentation more efficiently, thereby providing more accurate and better results
This standard has already been adopted by many popular organizations such as Cloudflare, Svelte, Bun, Anthropic, and Better Auth.
How can I implement this?
Very easy!
You just need to install the plugin and add it to your VitePress configuration
π¦ Installation
npm install vitepress-plugin-llms --save-dev
After that, add the plugin to the VitePress configuration (.vitepress/config.ts
):
import { defineConfig } from 'vitepress'
import llmstxt from 'vitepress-plugin-llms'
export default defineConfig({
vite: {
plugins: [llmstxt()]
}
})
A version of your documentation for LLMs will now be automatically generated π
The file structure in .vitepress/dist
folder will be as follows:
π .vitepress/dist
βββ ...
βββ llms-full.txt // A file where all the website documentation is compiled into one file
βββ llms.txt // The main file for LLMs with all links to all sections of the documentation for LLMs
βββ markdown-examples.html // A human-friendly version of `markdown-examples` section in HTML format
βββ markdown-examples.md // A LLM-friendly version of `markdown-examples` section in Markdown format
GitHub: https://github.com/okineadev/vitepress-plugin-llms
More details about plugin settings: https://github.com/okineadev/vitepress-plugin-llms#plugin-settings
Report a bug: https://github.com/okineadev/vitepress-plugin-llms/issues/new?template=bug-report.yml
β€οΈ Support: https://github.com/okineadev/vitepress-plugin-llms?sponsor=1
Happy coding π