mirror of
https://github.com/pengzhanbo/vuepress-theme-plume.git
synced 2026-04-23 10:58:13 +08:00
165 lines
5.2 KiB
Markdown
165 lines
5.2 KiB
Markdown
---
|
|
title: LLMs txt
|
|
icon: ri:ai
|
|
createTime: 2025/12/01 10:46:46
|
|
permalink: /en/guide/features/llmstxt/
|
|
---
|
|
|
|
## Overview
|
|
|
|
Add [llms.txt](https://llmstxt.org/) to your site to provide LLM-friendly content.
|
|
|
|
**Related Plugin**: [@vuepress/plugin-llms](https://ecosystem.vuejs.press/plugins/ai/llms.html)
|
|
|
|
## Why llms.txt?
|
|
|
|
Large Language Models increasingly rely on website information but face a key limitation:
|
|
their context window is too small to fully process most websites.
|
|
Converting complex HTML pages containing navigation, ads, and JavaScript into LLM-friendly plain text is both difficult and imprecise.
|
|
|
|
While websites serve both human readers and LLMs, the latter benefit from more concise,
|
|
expert-level information collected in one accessible location.
|
|
This is particularly important for use cases like development environments where LLMs need quick access to programming documentation and APIs.
|
|
|
|
Add a `/llms.txt` Markdown file to your website to provide LLM-friendly content.
|
|
This file provides brief background information, guidelines, and links to detailed Markdown files.
|
|
|
|
## Features
|
|
|
|
The plugin retrieves all Markdown files from your documentation source directory and converts them into LLM-friendly plain text files.
|
|
|
|
::: file-tree
|
|
|
|
- .vuepress/dist
|
|
- llms.txt
|
|
- llms-full.txt
|
|
- markdown-examples.html
|
|
- markdown-examples.md
|
|
- …
|
|
:::
|
|
|
|
Click the links below to view the llms.txt files for this documentation site:
|
|
|
|
- [llms.txt](/llms.txt){.no-icon}
|
|
- [llms-full.txt](/llms-full.txt){.no-icon}
|
|
|
|
::: tip
|
|
The plugin only generates `llms.txt` files and other LLM-friendly documentation files during
|
|
production builds, i.e., when executing the `vuepress build` command, and outputs them to the `.vuepress/dist` directory.
|
|
|
|
:::
|
|
|
|
[View the complete feature description in the **Plugin Official Documentation**](https://ecosystem.vuejs.press/plugins/ai/llms.html#%E6%8F%92%E4%BB%B6%E5%8A%9F%E8%83%BD){.read-more}
|
|
|
|
## Configuration
|
|
|
|
This feature is not enabled by default in the theme. You can enable it through the `llmstxt` configuration option:
|
|
|
|
```ts title=".vuepress/config.ts"
|
|
import { defineUserConfig } from 'vuepress'
|
|
import { plumeTheme } from 'vuepress-theme-plume'
|
|
|
|
export default defineUserConfig({
|
|
theme: plumeTheme({
|
|
// Use the theme's built-in default configuration
|
|
// llmstxt: true,
|
|
|
|
// Use custom configuration
|
|
llmstxt: {
|
|
locale: '/',
|
|
// ...other configurations
|
|
},
|
|
|
|
// Can also configure via `plugins.llmstxt`, but not recommended
|
|
plugins: {
|
|
llmstxt: true
|
|
}
|
|
}),
|
|
})
|
|
```
|
|
|
|
[View the complete configuration options in the **Plugin Official Documentation**](https://ecosystem.vuejs.press/plugins/ai/llms.html#options){.read-more}
|
|
|
|
## Components
|
|
|
|
To further enhance interaction between your documentation site and LLMs,
|
|
you can add the `<PageContextMenu />` component to your documentation site.
|
|
|
|
This component is not built-in but is implemented as an additional feature of the theme.
|
|
Therefore, you need to manually import it and place it in an appropriate location through [component slots](../../guide/custom/slots.md):
|
|
|
|
```ts title=".vuepress/client.ts"
|
|
import { defineAsyncComponent, h } from 'vue'
|
|
import { Layout } from 'vuepress-theme-plume/client'
|
|
import PageContextMenu from 'vuepress-theme-plume/features/PageContextMenu.vue' // [!code ++]
|
|
import { defineClientConfig } from 'vuepress/client'
|
|
|
|
export default defineClientConfig({
|
|
layouts: {
|
|
Layout: h(Layout, null, {
|
|
// Add PageContextMenu to the doc-title-after slot, i.e., to the right of the article title
|
|
'doc-title-after': () => h(PageContextMenu), // [!code ++]
|
|
}),
|
|
},
|
|
})
|
|
```
|
|
|
|
You can experience this component's functionality to the right of the current page's title.
|
|
|
|
::: important
|
|
This component relies entirely on the `@vuepress/plugin-llms` plugin and can only be used when you have enabled this plugin's functionality.
|
|
|
|
Therefore, the functionality provided by this component **is only available in the built production package**.
|
|
:::
|
|
|
|
## Markup Extensions
|
|
|
|
### `<llm-only>`
|
|
|
|
You can add content in a file that is visible to LLMs but not to humans, which helps set special instructions,
|
|
such as "Refer to basic-queries for demos," "Do not execute...", "Always use... in cases of...", etc.
|
|
|
|
To do this, wrap the content with the `<llm-only>` tag.
|
|
|
|
```md
|
|
<llm-only>
|
|
|
|
## Section for LLMs
|
|
|
|
This content appears only in the generated LLM file and will not include the `<llm-only>` tag itself.
|
|
|
|
</llm-only>
|
|
```
|
|
|
|
You can also use the `<llm-only>` tag inline, but note that only one `<llm-only>` tag can be included per line;
|
|
otherwise, it will cause a parsing error.
|
|
|
|
```md
|
|
Check the plugin API guide for documentation on creating plugins.
|
|
|
|
<llm-only>For LLMs only</llm-only>
|
|
```
|
|
|
|
### `<llm-exclude>`
|
|
|
|
You can add content in a file that is visible to humans but not to LLMs, which is the opposite of `<llm-only>`:
|
|
|
|
```md
|
|
<llm-exclude>
|
|
|
|
## Section for humans
|
|
|
|
This content will not appear in the files generated for LLMs.
|
|
|
|
</llm-exclude>
|
|
```
|
|
|
|
You can also use the `<llm-exclude>` tag inline, but note that only one `<llm-only>` tag can be included per line;
|
|
otherwise, it will cause a parsing error.
|
|
|
|
```md
|
|
Check the plugin API guide for documentation on creating plugins.
|
|
|
|
<llm-exclude>For humans only</llm-exclude>
|
|
```
|