--- title: 页面 frontmatter description: Estel Docs 文档与博客页面支持的 frontmatter 字段。 navigation: icon: lucide:file-text --- frontmatter 位于 Markdown 文件开头,用 YAML 描述标题、导航、SEO 和内容元数据。字段是否生效取决于页面类型和 `content.config.ts` 中的 collection schema。 ## 共享字段 | 字段 | 类型 | 说明 | | --- | --- | --- | | `title` | `string` | 页面标题,必填。 | | `description` | `string` | 页面描述,用于页面摘要和 SEO,必填。 | | `navigation` | `boolean \| object` | 是否显示在导航中,也可设置导航标题、描述、图标或重定向。 | | `icon` | `string` | 页面导航图标。 | | `date` | `string` | 页面日期,可选。博客必须提供。 | | `updated` | `string` | 最后更新时间,可选。 | | `draft` | `boolean` | 草稿标记;公开页面不应发布草稿内容。 | | `links` | `array` | 页面标题区域的操作链接,每项通常包含 `label`、`to`,以及可选的 `icon`、`target`。 | ### 导航对象 ```yaml navigation: title: 安装与开发 description: 本地安装和运行方法 icon: lucide:play ``` ### 页面链接 ```yaml links: - label: 编辑此页 icon: lucide:pencil to: https://github.com/estel-li/estel_docs/edit/main/content/docs/example.md target: _blank ``` ## 文档专属字段 文档位于 `content/docs/`,还支持: | 字段 | 类型 | 说明 | | --- | --- | --- | | `fullpage` | `boolean` | 使用全页面布局。 | | `badges` | `array` | 显示在页面标题区域的徽章。 | | `navBadges` | `array` | 显示在侧边栏导航项上的徽章。 | ```yaml --- title: 示例文档 description: 文档摘要。 navigation: icon: lucide:file-text fullpage: false badges: - value: New type: lime navBadges: - value: Beta --- ``` ## 博客专属字段 博客位于 `content/blog/`,以下两个字段是必填项: | 字段 | 类型 | 说明 | | --- | --- | --- | | `img` | `string` | 列表和详情页使用的封面图片地址。 | | `date` | `string` | 发布日期,用于排序和展示。 | | `category` | `string` | 可选分类。 | | `tags` | `string[]` | 可选标签列表。 | ```yaml --- title: Nuxt 内容实践 description: 使用 Markdown 管理内容。 img: https://img.example.com/nuxt.jpg date: 2026-08-20 category: 技术 tags: - Nuxt - Markdown --- ``` ## 注意事项 - YAML 缩进必须使用空格,不能混用 Tab。 - frontmatter 字段不能替代 Markdown 正文标题;正文应保持清晰的标题层级。 - `rawbody` 由内容系统生成,不需要手动填写。 - 新增或修改字段后运行 `pnpm content:check`,再用 `pnpm typecheck` 检查类型问题。