跳转到主要内容
使用 docs.json 文件中的这些设置来控制站点的信息架构和用户体验。修改导航栏、页脚、横幅、导航行为、上下文菜单、重定向和全局内容变量。

设置

类型: object 内容的导航结构。在这里使用分组、标签页、下拉菜单、锚点等定义站点的完整页面层次结构。 查看 导航 获取构建导航结构的完整文档。
navigation.global
object
在所有页面和语言环境中显示的全局导航元素。
navigation.languages
array of object
多语言 站点的语言切换器。每个条目除了导航结构外,还可以包含特定语言的 bannerfooternavbar 配置。
navigation.versions
array of object
多版本 站点的版本切换器。
navigation.tabs
array of object
顶级导航 标签页
navigation.anchors
array of object
侧边栏 锚点
navigation.dropdowns
array of object
用于分组相关内容的 下拉菜单
navigation.products
array of object
产品 站点的产品切换器。
navigation.groups
array of object
用于将内容组织成章节的 分组
navigation.pages
array of string or object
组成文档的各个 页面

类型: object 顶部导航栏中显示的链接和按钮。
在导航栏中显示的链接。
navbar.primary
object
导航栏中的主要行动号召按钮。
docs.json
"navbar": {
  "links": [
    { "type": "github", "href": "https://github.com/your-org/your-repo" },
    { "label": "Community", "href": "https://example.com/community" }
  ],
  "primary": {
    "type": "button",
    "label": "Get started",
    "href": "https://example.com/signup"
  }
}

类型: object 页脚内容和社交媒体链接。
在页脚中显示的社交媒体资料。每个键是平台名称,每个值是你的资料 URL。有效的键:xwebsitefacebookyoutubediscordslackgithublinkedininstagramhacker-newsmediumtelegramtwitterx-twitterearth-americasblueskythreadsredditpodcast
"socials": {
  "x": "https://x.com/yourhandle",
  "github": "https://github.com/your-org"
}
在页脚中显示的链接列。
docs.json
"footer": {
  "socials": {
    "x": "https://x.com/yourhandle",
    "github": "https://github.com/your-org"
  },
  "links": [
    {
      "header": "Company",
      "items": [
        { "label": "Blog", "href": "https://example.com/blog" },
        { "label": "Careers", "href": "https://example.com/careers" }
      ]
    }
  ]
}

类型: object 显示在每个页面顶部的全站横幅。
banner.content
string
必填
横幅中显示的文本内容。支持基本 MDX 格式,包括链接、粗体和斜体文本。不支持自定义组件。
"content": "We just launched something new. [Learn more](https://example.com)"
banner.dismissible
boolean
是否显示关闭按钮让用户可以关闭横幅。默认为 false
docs.json
"banner": {
  "content": "We just launched something new. [Learn more](https://example.com)",
  "dismissible": true
}

interaction

类型: object 控制导航元素的用户交互行为。
interaction.drilldown
boolean
控制选择导航组时的自动导航。设为 true 在组展开时自动导航到第一个页面。设为 false 仅展开或折叠组而不导航。不设置则使用主题的默认行为。

contextual

类型: object 上下文菜单让用户快速访问 AI 工具和页面操作。它显示在页面标题或目录侧边栏中。
上下文菜单仅在预览和生产部署中可用。
contextual.options
array
必填
上下文菜单中可用的操作。数组中的第一个选项显示为默认操作。内置选项:
  • "add-mcp" — 将你的 MCP 服务器添加到用户配置
  • "aistudio" — 将当前页面发送到 Google AI Studio
  • "assistant" — 以当前页面为上下文打开 AI 助手
  • "copy" — 将当前页面复制为 Markdown 到剪贴板
  • "chatgpt" — 将当前页面发送到 ChatGPT
  • "claude" — 将当前页面发送到 Claude
  • "cursor" — 在 Cursor 中安装你托管的 MCP 服务器
  • "devin" — 将当前页面发送到 Devin
  • "grok" — 将当前页面发送到 Grok
  • "mcp" — 将你的 MCP 服务器 URL 复制到剪贴板
  • "perplexity" — 将当前页面发送到 Perplexity
  • "view" — 在新标签页中以 Markdown 查看当前页面
  • "vscode" — 在 VS Code 中安装你托管的 MCP 服务器
  • "windsurf" — 将当前页面发送到 Windsurf
将自定义选项定义为对象:
contextual.display
"header" | "toc"
上下文选项的显示位置。选择 header 在页面顶部上下文菜单中显示,或选择 toc 在目录侧边栏中显示。默认为 header
docs.json
"contextual": {
  "options": ["copy", "view", "chatgpt", "claude"],
  "display": "header"
}

redirects

类型: array of object 移动、重命名或删除的页面的重定向。用于在重组内容时保留链接。
redirects[].source
string
必填
重定向的来源路径。示例:/old-page
redirects[].destination
string
必填
重定向的目标路径。示例:/new-page
redirects[].permanent
boolean
如果为 true,发出永久重定向 (308)。如果为 false,发出临时重定向 (307)。默认为 true
docs.json
"redirects": [
  {
    "source": "/old-page",
    "destination": "/new-page"
  },
  {
    "source": "/temp-redirect",
    "destination": "/destination",
    "permanent": false
  }
]

errors

类型: object 自定义错误页面设置。
errors.404
object
404”页面未找到”错误页面的设置。
docs.json
"errors": {
  "404": {
    "redirect": false,
    "title": "Page not found",
    "description": "The page you're looking for doesn't exist. [Go home](/)."
  }
}

variables

类型: object 在整个文档中使用的全局变量。Mintlify 在构建时用定义的值替换 {{variableName}} 占位符。
variables.[variableName]
string
键值对,其中键是变量名,值是替换文本。
  • 变量名可以包含字母数字字符、连字符和句点。
  • 必须定义内容中引用的所有变量,否则构建会失败。
  • Mintlify 会净化值以防止 XSS 攻击。
docs.json
"variables": {
  "version": "2.0.0",
  "api-url": "https://api.example.com"
}
在内容中,使用双大括号引用变量:
The current version is {{version}}. Make requests to {{api-url}}.

metadata

类型: object 全局应用的页面级元数据设置。
metadata.timestamp
boolean
在所有页面上启用最后修改日期。启用后,页面显示内容最后修改的日期。默认为 false你可以使用 timestamp frontmatter 字段在单个页面上覆盖此设置。查看 页面 了解详情。
docs.json
"metadata": {
  "timestamp": true
}