name: docs-creator description: 使用 Fumadocs 创建和组织公共文档页面。在构建新文档页面或组织现有页面时使用。
文档创建技能
此技能可帮助您在 src/content/docs 目录中构建面向公众的文档。该系统由 Fumadocs 提供支持,并支持 MDX、自动路由和 Lucide 图标。
核心概念
1. 文件结构
- 根目录:
src/content/docs/ - 页面:
.mdx文件成为页面(例如,getting-started.mdx->/docs/getting-started)。 - 嵌套: 文件夹创建 URL 路径段(例如,
api/auth.mdx->/docs/api/auth)。 - 图片: 已启用自动 OG 图片生成。
2. 前言 (Frontmatter)
每个 .mdx 文件都应包含前言:
---
title: 页面标题
description: 用于 SEO 和搜索的简短描述
icon: Box # Lucide 图标名称
---
3. 文件夹组织 (meta.json)
通过在任何目录中放置一个 meta.json 文件来控制侧边栏顺序、组标题和图标。
{
"title": "章节名称",
"icon": "Settings",
"pages": [
"index", // 匹配 index.mdx
"getting-started", // 匹配 getting-started.mdx
"---Separator---", // 添加视觉分隔符
"advanced" // 匹配 advanced/ 文件夹或文件
],
"defaultOpen": true
}
功能特性
- Lucide 图标: 在前言中使用任何 Lucide 图标名称
icon: 名称。 - 组件: 所有标准 MDX 组件 + Fumadocs UI 组件(Callout、Cards、Tabs)均可用。
- 相对链接:
[链接](./other-page)可正确工作。 - 站点地图: 自动生成。
示例
基础页面 (src/content/docs/introduction.mdx)
---
title: 介绍
description: 开始使用我们的平台
icon: BookOpen
---
# 欢迎
这是介绍页面。
## 后续步骤
- [安装](./installation)
- [配置](./config)
文件夹元数据 (src/content/docs/api/meta.json)
{
"title": "API 参考",
"icon": "Webhook",
"root": true,
"pages": ["introduction", "endpoints", "authentication"]
}
注意:如果使用根级文件夹,"root": true 会使此文件夹在侧边栏中成为一个单独的选项卡。