Generate /llms.txt for your documentation website on VitePress

Okinea Dev
2 min readMar 25, 2025

--

vitepress-plugin-llms

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

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

No responses yet

Write a response