docs.json 文件可将一组 Markdown 文件转换为可浏览、可自定义的文档站点。这个必填的配置文件控制样式、导航、integrations 等内容。可以把它看作你的文档蓝图。
docs.json 中的设置会全局应用于所有页面。
配置你的 docs.json
theme、name、colors.primary 和 navigation。其他字段可选,可根据文档需求的增长逐步添加。
为获得最佳编辑体验,请在 docs.json 文件的顶部加入 schema 引用。这将在大多数代码编辑器中启用自动补全、校验和实用的悬浮提示:
报告错误代码
复制
询问AI
{
"$schema": "https://mintlify.com/docs.json",
"theme": "mint",
"name": "您的文档",
"colors": {
"primary": "#ff0000"
},
"navigation": {
// 您的导航结构
}
// 配置的其余部分
}
参考
docs.json 文件的完整参考资料。
自定义
你的项目、组织或产品名称。
文档中使用的配色。不同主题对颜色的应用方式有所不同。如果你只提供主色,它将用于所有颜色元素。
显示 Colors
显示 Colors
你的网站说明,用于 SEO(搜索引擎优化)和 AI 索引编入。
用于社交媒体和页面预览的缩略图自定义。
显示 Thumbnails
显示 Thumbnails
缩略图的视觉主题。若未指定,缩略图将使用你在
colors 字段中定义的网站配色方案。缩略图的背景图像。可以是相对路径或绝对 URL。
缩略图的字体配置。仅支持 Google Fonts 的字体系列名称。
显示 Fonts
显示 Fonts
字体系列名称,例如 “Open Sans” 或 “Playfair Display”。支持 Google Fonts 的字体系列名称。
视觉样式配置。
显示 Styling
显示 Styling
页面 eyebrow 区域的样式。选择
section 显示所属章节名称,选择 breadcrumbs 显示完整导航路径。默认为 section。控制是否包含 LaTeX 样式表,并覆盖自动检测。默认情况下,Mintlify 会自动检测内容中的 LaTeX 使用情况并加载所需的样式表。
- 设置为
true:当自动检测未能识别你的数学表达式时,强制加载 LaTeX 样式表。 - 设置为
false:如果你不使用数学表达式,但内容会触发误检,可阻止加载 LaTeX 样式表,以提升性能。
代码块主题配置。默认为
"system"。简单配置:"system":匹配当前站点模式(light 或 dark)"dark":始终使用 dark 模式
一个同时用于 light 和 dark 两种模式的 Shiki 主题名称。
报告错误代码
复制
询问AI
"styling": {
"codeblocks": {
"theme": "dracula"
}
}
图标库设置。
显示 Icons
显示 Icons
在整个文档中使用的图标库。默认为
fontawesome。无论库设置为何,你都可以为任意单个图标指定指向外部托管图标的 URL、项目中图标文件的路径,或 JSX 兼容的 SVG 代码。
为文档设置自定义字体。默认字体随主题不同而变化。
显示 Fonts
显示 Fonts
字体系列,例如 “Open Sans”。支持 Google Fonts 的 family 名称。
字重,例如 400 或 700。可变字体支持精确字重,如 550。
取以下之一:
- 托管字体的 URL,例如 https://mintlify-assets.b-cdn.net/fonts/Hubot-Sans.woff2。
- 本地字体文件的路径,例如
/fonts/Hubot-Sans.woff2。
family 名称时,Google Fonts 会自动加载,因此无需提供 source URL。字体文件格式。使用
source 字段时必填。专用于标题的字体设置覆盖。
显示 Heading
显示 Heading
字体系列,例如 “Open Sans”、“Playfair Display”。支持 Google Fonts 的 family 名称。
字重,例如 400、700。可变字体支持精确字重,如 550。
取以下之一:
- 托管字体的 URL,例如 https://mintlify-assets.b-cdn.net/fonts/Hubot-Sans.woff2。
- 本地字体文件的路径,例如
/fonts/Hubot-Sans.woff2。
family 名称时,Google Fonts 会自动加载,因此无需提供 source URL。字体文件格式。使用
source 字段时必填。专用于正文的字体设置覆盖。
显示 Body
显示 Body
字体系列,例如 “Open Sans”、“Playfair Display”。支持 Google Fonts 的 family 名称。
字重,例如 400、700。可变字体支持精确字重,如 550。
取以下之一:
- 托管字体的 URL,例如 https://mintlify-assets.b-cdn.net/fonts/Hubot-Sans.woff2。
- 本地字体文件的路径,例如
/fonts/Hubot-Sans.woff2。
family 名称时,Google Fonts 会自动加载,因此无需提供 source URL。字体文件格式。使用
source 字段时必填。背景颜色与装饰设置。
显示 Background
显示 Background
主题的背景装饰效果。
结构
导航栏中的外部链接项目。
显示 Navbar
显示 Navbar
要在导航栏中显示的链接。
显示 Links
显示 Links
链接文本。
链接目标。必须为有效的外部 URL。
L’icône à afficher.Options :
- nom de l’icône Font Awesome
- nom de l’icône Lucide
- code SVG (compatible JSX) entouré d’accolades
- URL vers une icône hébergée en externe
- chemin vers un fichier d’icône dans votre projet
- Convertissez votre SVG à l’aide du convertisseur SVGR.
- Collez votre code SVG dans le champ de saisie SVG.
- Copiez l’élément complet
<svg>...</svg>depuis le champ de sortie JSX. - Entourez le code SVG compatible JSX avec des accolades :
icon={<svg ...> ... </svg>}. - Ajustez
heightetwidthsi nécessaire.
Le style d’icône Font Awesome. Utilisé uniquement avec les icônes Font Awesome.Options :
regular, solid, light, thin, sharp-solid, duotone, brands.内容的导航结构。
显示 导航
显示 导航
在所有页面和部分中显示的全局导航元素。
显示 全局
显示 全局
用于组织主要部分的顶级导航选项卡。
显示 Tabs
显示 Tabs
标签页的显示名称。最小长度:1
L’icône à afficher.Options :
- nom de l’icône Font Awesome
- nom de l’icône Lucide
- code SVG (compatible JSX) entouré d’accolades
- URL vers une icône hébergée en externe
- chemin vers un fichier d’icône dans votre projet
- Convertissez votre SVG à l’aide du convertisseur SVGR.
- Collez votre code SVG dans le champ de saisie SVG.
- Copiez l’élément complet
<svg>...</svg>depuis le champ de sortie JSX. - Entourez le code SVG compatible JSX avec des accolades :
icon={<svg ...> ... </svg>}. - Ajustez
heightetwidthsi nécessaire.
Le style d’icône Font Awesome. Utilisé uniquement avec les icônes Font Awesome.Options :
regular, solid, light, thin, sharp-solid, duotone, brands.是否默认隐藏此标签页。
该标签页目标的 URL 或路径。
在侧边栏导航中显著显示的锚点链接。
显示 Anchors
显示 Anchors
锚点的显示名称。最小长度:1
L’icône à afficher.Options :
- nom de l’icône Font Awesome
- nom de l’icône Lucide
- code SVG (compatible JSX) entouré d’accolades
- URL vers une icône hébergée en externe
- chemin vers un fichier d’icône dans votre projet
- Convertissez votre SVG à l’aide du convertisseur SVGR.
- Collez votre code SVG dans le champ de saisie SVG.
- Copiez l’élément complet
<svg>...</svg>depuis le champ de sortie JSX. - Entourez le code SVG compatible JSX avec des accolades :
icon={<svg ...> ... </svg>}. - Ajustez
heightetwidthsi nécessaire.
Le style d’icône Font Awesome. Utilisé uniquement avec les icônes Font Awesome.Options :
regular, solid, light, thin, sharp-solid, duotone, brands.是否默认隐藏此锚点。
锚点目标的 URL 或路径。
用于组织相关内容的下拉菜单。
显示 下拉菜单
显示 下拉菜单
下拉菜单的显示名称。最小长度:1
L’icône à afficher.Options :
- nom de l’icône Font Awesome
- nom de l’icône Lucide
- code SVG (compatible JSX) entouré d’accolades
- URL vers une icône hébergée en externe
- chemin vers un fichier d’icône dans votre projet
- Convertissez votre SVG à l’aide du convertisseur SVGR.
- Collez votre code SVG dans le champ de saisie SVG.
- Copiez l’élément complet
<svg>...</svg>depuis le champ de sortie JSX. - Entourez le code SVG compatible JSX avec des accolades :
icon={<svg ...> ... </svg>}. - Ajustez
heightetwidthsi nécessaire.
Le style d’icône Font Awesome. Utilisé uniquement avec les icônes Font Awesome.Options :
regular, solid, light, thin, sharp-solid, duotone, brands.是否默认隐藏此下拉菜单。
下拉菜单目标的 URL 或路径。
用于将内容分组为不同部分的产品。
显示 Products
显示 Products
产品的显示名称。
产品的描述。
L’icône à afficher.Options :
- nom de l’icône Font Awesome
- nom de l’icône Lucide
- code SVG (compatible JSX) entouré d’accolades
- URL vers une icône hébergée en externe
- chemin vers un fichier d’icône dans votre projet
- Convertissez votre SVG à l’aide du convertisseur SVGR.
- Collez votre code SVG dans le champ de saisie SVG.
- Copiez l’élément complet
<svg>...</svg>depuis le champ de sortie JSX. - Entourez le code SVG compatible JSX avec des accolades :
icon={<svg ...> ... </svg>}. - Ajustez
heightetwidthsi nécessaire.
Le style d’icône Font Awesome. Utilisé uniquement avec les icônes Font Awesome.Options :
regular, solid, light, thin, sharp-solid, duotone, brands.用于multi-language站点的语言切换器。
导航元素的用户交互设置。
显示 Interaction
显示 Interaction
控制选择导航分组时的自动导航行为。设置为
true 时,在展开导航分组时会强制跳转到该分组中的第一个页面。设置为 false 时将不会跳转,仅展开或折叠该分组。不设置时将使用主题的默认行为。页脚内容与社交媒体链接。
显示 Footer
显示 Footer
要在页脚中显示的社交媒体账号信息。每个键是平台名称,每个值是你的个人主页 URL。例如:可用的属性名:
报告错误代码
复制
询问AI
{
"x": "https://x.com/mintlify"
}
x, website, facebook, youtube, discord, slack, github, linkedin, instagram, hacker-news, medium, telegram, twitter, x-twitter, earth-americas, bluesky, threads, reddit, podcast用于 AI 优化内容和集成的上下文菜单。
显示 Contextual
显示 Contextual
options
array of "copy" | "view" | "chatgpt" | "claude" | "perplexity" | "mcp" | "cursor" | "vscode"
required
上下文菜单中可用的操作。第一个选项会作为默认选项显示。
copy: 将当前页面以 Markdown 格式复制到剪贴板。view: 在新标签页中以 Markdown 格式查看当前页面。chatgpt: 将当前页面内容发送到 ChatGPT。claude: 将当前页面内容发送到 Claude。perplexity: 将当前页面内容发送到 Perplexity。mcp: 将你的 MCP 服务器 URL 复制到剪贴板。cursor: 在 Cursor 中安装你托管的 MCP 服务器。vscode: 在 VSCode 中安装你托管的 MCP 服务器。

上下文菜单仅在预览和生产环境的部署中可用。
API 配置
API 文档和交互式操作台的设置。
显示 Api
显示 Api
自动生成的 API 示例的配置。
显示 Examples
显示 Examples
自动生成的 API 代码片段所使用的示例语言。支持的语言包括:
bash(显示为 cURL)gojavajavascriptnode(显示为 Node.js)phppowershellpythonrubyswift
curl、golang、js、nodejs、rb、sh。是否在 API 示例中展示可选参数。默认为
all。是否使用 schema 示例数据预填 API 操作台。启用后,操作台会自动使用 OpenAPI 规范中的示例值填充请求字段。默认为
false。SEO 和搜索
SEO(搜索引擎优化)索引配置。
显示 Seo
显示 Seo
添加到每个页面的 Meta 标签。必须为有效的 key-value 对。可参考常用 Meta 标签获取可选项。
指定哪些页面应被搜索引擎索引。选择
navigable 仅索引位于 docs.json 中 navigation 的页面,选择 all 则索引所有页面。默认值为 navigable。集成
第三方集成。
显示 集成
显示 集成
Google Analytics 4 集成。
显示 Ga4
显示 Ga4
您的 Google Analytics 4 测量 ID。必须符合模式:^G
Google Tag Manager 集成。
显示 Gtm
显示 Gtm
您的 Google Tag Manager 标签 ID。必须符合模式:^G
错误
示例
- 基础示例
- 交互式 API 示例
- 多语言示例
docs.json
报告错误代码
复制
询问AI
{
"$schema": "https://mintlify.com/docs.json",
"theme": "maple",
"name": "Example Co.",
"description": "Example Co. 是一家提供示例内容和占位符文本的公司。",
"colors": {
"primary": "#3B82F6",
"light": "#F8FAFC",
"dark": "#0F172A"
},
"navigation": {
"dropdowns": [
{
"dropdown": "文档",
"icon": "book",
"description": "如何使用 Example Co. 产品",
"groups": [
{
"group": "快速开始",
"pages": [
"index",
"quickstart"
]
},
{
"group": "自定义",
"pages": [
"settings",
"users",
"features"
]
},
{
"group": "计费",
"pages": [
"billing/overview",
"billing/payments",
"billing/subscriptions"
]
}
]
},
{
"dropdown": "更新日志",
"icon": "history",
"description": "更新和变更",
"pages": [
"changelog"
]
}
]
},
"logo": {
"light": "/logo-light.svg",
"dark": "/logo-dark.svg",
"href": "https://example.com"
},
"navbar": {
"links": [
{
"label": "社区",
"href": "https://example.com/community"
}
],
"primary": {
"type": "button",
"label": "开始使用",
"href": "https://example.com/start"
}
},
"footer": {
"socials": {
"x": "https://x.com/example",
"linkedin": "https://www.linkedin.com/company/example",
"github": "https://github.com/example",
"slack": "https://example.com/community"
},
"links": [
{
"header": "资源",
"items": [
{
"label": "客户",
"href": "https://example.com/customers"
},
{
"label": "企业版",
"href": "https://example.com/enterprise"
},
{
"label": "申请预览",
"href": "https://example.com/preview"
}
]
},
{
"header": "公司",
"items": [
{
"label": "招聘",
"href": "https://example.com/careers"
},
{
"label": "博客",
"href": "https://example.com/blog"
},
{
"label": "隐私政策",
"href": "https://example.com/legal/privacy"
}
]
}
]
},
"integrations": {
"ga4": {
"measurementId": "G-XXXXXXXXXX"
},
"telemetry": {
"enabled": true
},
"cookies": {
"key": "example_cookie_key",
"value": "example_cookie_value"
}
},
"contextual": {
"options": [
"copy",
"view",
"chatgpt",
"claude"
]
},
"errors": {
"404": {
"redirect": false,
"title": "找不到页面",
"description": "这个_页面_到底**发生了什么**?"
}
}
}
从 mint.json 升级
mint.json 文件,请按照以下步骤升级到 docs.json。
1
安装或更新命令行界面(CLI)
2
创建 docs.json 文件
在你的文档存储库中运行:该命令会根据现有的
报告错误代码
复制
询问AI
mint upgrade
mint.json 生成一个 docs.json 文件。请检查生成的文件以确保所有设置正确。3
删除 mint.json 文件
在确认
docs.json 配置无误后,即可安全删除旧的 mint.json 文件。