<!-- Generated from zh/llms-txt-vue/index.html. The canonical document is the HTML page. -->

- [ 首页 ](/zh/) 
/
- [ 如何创建 llms.txt ](/zh/how-to-create/) 
/
- Vue（Vite）            
# Vue（Vite）中的 `llms.txt`

用 Vite 脚手架创建的 Vue 3 应用会以零配置从 public/ 文件夹提供 llms.txt。

最近更新: 2026年7月26日

本页内容

- [ 文件的放置位置 ](#overview)
- [ public/ 文件夹中的方法 ](#public)
- [ 验证设置 ](#verify)            
## 文件放在哪里

使用 Vite 构建的 Vue 应用（Vue 3 以来的默认工具链）会将该 `public/` 目录 作为静态目录：其中的文件会复制到构建输出根目录，并在开发期间从网站根目录提供。位于
`public/llms.txt` 可通过以下地址访问： `/llms.txt` ，无需配置。

当 Vue 应用具有稳定的公开路由时，此方案效果最佳。如果路由完全在客户端处理，请确保列在 `llms.txt` 在直接获取时返回有意义的 HTML 或文档页面， 而不是只有经过 JavaScript 导航后才能访问。

## public/ 文件夹中的方法

- 创建文件： `touch public/llms.txt` （标准 Vite 脚手架中已存在该文件夹）。 
- 编写你的内容（请参阅 [操作指南](/zh/how-to-create/) 和 [生成器](/zh/generator/)):   
```
# Your Site Name

> One-sentence description of your site for LLM context.

## Core pages

- [Page title](https://yourdomain.com/page/): brief description.
- [Docs](https://yourdomain.com/docs/): developer documentation.

```

- 运行 `npm run dev` 以便在本地检查 `http://localhost:5173/llms.txt`，
然后 `npm run build` 并部署。     
示例

使用根目录绝对路径

将文件引用为  /llms.txt ，而不是  /public/llms.txt . Vite 会剥离
public/  前缀，而  public/  从不被处理或哈希，因此 URL 保持稳定。

## 验证设置

部署后，请确认文件能够加载并以文本形式提供：

```
curl -sI https://yourdomain.com/llms.txt | grep -i content-type
# expect: content-type: text/plain
```

对于内联完整页面内容的版本，请添加
[`llms-full.txt`](/zh/llms-full-txt/) 以同样方式添加。使用 Nuxt 而不是原生 Vue？请参阅
[Nuxt 指南](/zh/llms-txt-nuxt/)。完成后请使用
[验证器](/zh/validator/) 完成后进行检查。

## 来源

- [ Vite 文档，public 目录 ](https://vite.dev/guide/assets)
- [ llmstxt.org，规范参考 ](https://llmstxt.org/)
