# 全局设置 (/zh/organize/settings)

<!-- agent-signals: reading_time_min: 4 · est_tokens: 2289 · updated: 2026-07-30 -->
Related: [外观与品牌](/zh/organize/settings-appearance.md), [站点结构](/zh/organize/settings-structure.md), [API 设置](/zh/organize/settings-api.md), [集成](/zh/organize/settings-integrations.md), [SEO 和搜索](/zh/organize/settings-seo.md), [docs.json schema 参考](/zh/organize/settings-reference.md)

`docs.json` 文件是 Mintlify 文档站点的核心配置文件。它控制站点的全局设置，包括视觉品牌、导航结构、集成、API 设置等。可以把它看作站点的蓝图。

## 必需字段 [#必需字段]

你必须定义四个字段才能构建一个可用的站点。

| 字段               | 描述                              |
| ---------------- | ------------------------------- |
| `name`           | 你的项目或组织名称                       |
| `theme`          | 站点的布局[主题](/zh/customize/themes) |
| `colors.primary` | 主品牌颜色，使用十六进制代码                  |
| `navigation`     | 你的内容结构                          |

所有其他字段都是可选的。你可以在自定义和完善站点时逐步添加它们。

## 最小配置 [#最小配置]

为了获得最佳编辑体验，请在 `docs.json` 的顶部包含 `$schema` 引用。这将在大多数编辑器中启用自动补全、校验和内联文档。

```json title="docs.json"
{
  "$schema": "https://mintlify.com/docs.json",
  "theme": "mint",
  "name": "你的项目名称",
  "colors": {
    "primary": "#ff0000"
  },
  "navigation": {
    "groups": [
      {
        "group": "首页",
        "pages": ["index"]
      }
    ]
  }
}
```

## 设置 [#设置]

<CardGroup cols="2">
  <Card title="外观与品牌" icon="<svg xmlns=&#x22;http://www.w3.org/2000/svg&#x22; viewBox=&#x22;0 0 24 24&#x22; fill=&#x22;none&#x22;><path d=&#x22;M13.435 7L7.15915 13.2759M7.15915 13.2759L4.82728 15.6077C3.92569 16.5093 3.47489 16.9601 3.23745 17.5334C3 18.1066 3 18.7441 3 20.0192V21H3.98082C5.25586 21 5.89338 21 6.46663 20.7626C7.03988 20.5251 7.49068 20.0743 8.39227 19.1727L14.2891 13.2759M7.15915 13.2759H14.2891M14.2891 13.2759L17 10.565&#x22; stroke=&#x22;currentColor&#x22; stroke-linecap=&#x22;round&#x22; stroke-linejoin=&#x22;round&#x22; stroke-width=&#x22;1.5&#x22;/><path d=&#x22;M19.2087 8.38869L20.82 10M19.2087 8.38869L20.0705 7.52682C20.363 7.23431 20.5093 7.08805 20.611 6.94529C21.1297 6.21676 21.1297 5.23953 20.611 4.511C20.5093 4.36824 20.363 4.22198 20.0705 3.92947C19.778 3.63697 19.6318 3.4907 19.489 3.38905C18.7605 2.87032 17.7832 2.87032 17.0547 3.38905C16.912 3.4907 16.7657 3.63695 16.4732 3.92947L15.6113 4.79133M19.2087 8.38869L15.6113 4.79133M14 3.18002L15.6113 4.79133&#x22; stroke=&#x22;currentColor&#x22; stroke-linecap=&#x22;round&#x22; stroke-linejoin=&#x22;round&#x22; stroke-width=&#x22;1.5&#x22;/></svg>" href="/zh/organize/settings-appearance">
    自定义站点的视觉外观，包括主题、颜色、logo、favicon、字体和背景。
  </Card>

  <Card title="站点结构" icon="<svg xmlns=&#x22;http://www.w3.org/2000/svg&#x22; viewBox=&#x22;0 0 24 24&#x22; fill=&#x22;none&#x22;><path d=&#x22;M20.1088 20.1088C18.7175 21.5 16.4783 21.5 12 21.5C7.52166 21.5 5.28249 21.5 3.89124 20.1088C2.5 18.7175 2.5 16.4783 2.5 12C2.5 7.52166 2.5 5.28248 3.89124 3.89124C5.28249 2.5 7.52166 2.5 12 2.5C16.4783 2.5 18.7175 2.5 20.1088 3.89124C21.5 5.28249 21.5 7.52166 21.5 12C21.5 16.4783 21.5 18.7175 20.1088 20.1088Z&#x22; stroke=&#x22;currentColor&#x22; stroke-linecap=&#x22;round&#x22; stroke-linejoin=&#x22;round&#x22; stroke-width=&#x22;1.5&#x22;/><path d=&#x22;M9 21.5L9 2.5&#x22; stroke=&#x22;currentColor&#x22; stroke-width=&#x22;1.5&#x22;/></svg>" href="/zh/organize/settings-structure">
    设计站点的信息架构和用户体验，包括导航栏、页脚、横幅、导航和重定向。
  </Card>

  <Card title="API 设置" icon="<svg xmlns=&#x22;http://www.w3.org/2000/svg&#x22; viewBox=&#x22;0 0 24 24&#x22; fill=&#x22;none&#x22;><path d=&#x22;M2.5 12C2.5 7.52166 2.5 5.28249 3.89124 3.89124C5.28249 2.5 7.52166 2.5 12 2.5C16.4783 2.5 18.7175 2.5 20.1088 3.89124C21.5 5.28249 21.5 7.52166 21.5 12C21.5 16.4783 21.5 18.7175 20.1088 20.1088C18.7175 21.5 16.4783 21.5 12 21.5C7.52166 21.5 5.28249 21.5 3.89124 20.1088C2.5 18.7175 2.5 16.4783 2.5 12Z&#x22; stroke=&#x22;currentColor&#x22; stroke-linecap=&#x22;round&#x22; stroke-linejoin=&#x22;round&#x22; stroke-width=&#x22;1.5&#x22;/><path d=&#x22;M9.5 9.5L7.96682 10.8215C7.32228 11.377 7 11.6548 7 12C7 12.3452 7.32227 12.623 7.96682 13.1785L9.5 14.5&#x22; stroke=&#x22;currentColor&#x22; stroke-linecap=&#x22;round&#x22; stroke-linejoin=&#x22;round&#x22; stroke-width=&#x22;1.5&#x22;/><path d=&#x22;M14.5 9.5L16.0332 10.8215C16.6777 11.377 17 11.6548 17 12C17 12.3452 16.6777 12.623 16.0332 13.1785L14.5 14.5&#x22; stroke=&#x22;currentColor&#x22; stroke-linecap=&#x22;round&#x22; stroke-linejoin=&#x22;round&#x22; stroke-width=&#x22;1.5&#x22;/></svg>" href="/zh/organize/settings-api">
    控制 API 文档的显示和行为，包括 OpenAPI 和 AsyncAPI 规范、API 演练场和代码示例。
  </Card>

  <Card title="集成" icon="<svg xmlns=&#x22;http://www.w3.org/2000/svg&#x22; viewBox=&#x22;0 0 24 24&#x22; fill=&#x22;none&#x22;><path d=&#x22;M15.5 2V6M8.5 6V2&#x22; stroke=&#x22;currentColor&#x22; stroke-linecap=&#x22;round&#x22; stroke-linejoin=&#x22;round&#x22; stroke-width=&#x22;1.5&#x22;/><path d=&#x22;M6.00446 7.61331C5.93719 6.74273 6.63957 6 7.53014 6H16.4699C17.3604 6 18.0628 6.74273 17.9955 7.61331L17.8117 9.99197C17.6796 11.7019 17.1011 13.3498 16.132 14.7773L15.5312 15.6622C14.9638 16.4979 14.0077 17 12.9838 17H11.0162C9.99228 17 9.03617 16.4979 8.46881 15.6622L7.86803 14.7773C6.89885 13.3498 6.32041 11.7019 6.18827 9.99197L6.00446 7.61331Z&#x22; stroke=&#x22;currentColor&#x22; stroke-width=&#x22;1.5&#x22;/><path d=&#x22;M12 17V22&#x22; stroke=&#x22;currentColor&#x22; stroke-linecap=&#x22;round&#x22; stroke-linejoin=&#x22;round&#x22; stroke-width=&#x22;1.5&#x22;/><path d=&#x22;M11 9H13&#x22; stroke=&#x22;currentColor&#x22; stroke-linecap=&#x22;round&#x22; stroke-linejoin=&#x22;round&#x22; stroke-width=&#x22;1.5&#x22;/></svg>" href="/zh/organize/settings-integrations">
    将站点连接到第三方服务，用于分析、聊天等功能。
  </Card>

  <Card title="SEO 和搜索" icon="<svg xmlns=&#x22;http://www.w3.org/2000/svg&#x22; viewBox=&#x22;0 0 24 24&#x22; fill=&#x22;none&#x22;><path d=&#x22;M17 17L21 21&#x22; stroke=&#x22;currentColor&#x22; stroke-linecap=&#x22;round&#x22; stroke-linejoin=&#x22;round&#x22; stroke-width=&#x22;1.5&#x22;/><path d=&#x22;M19 11C19 6.58172 15.4183 3 11 3C6.58172 3 3 6.58172 3 11C3 15.4183 6.58172 19 11 19C15.4183 19 19 15.4183 19 11Z&#x22; stroke=&#x22;currentColor&#x22; stroke-linecap=&#x22;round&#x22; stroke-linejoin=&#x22;round&#x22; stroke-width=&#x22;1.5&#x22;/></svg>" href="/zh/organize/settings-seo">
    控制搜索引擎如何索引你的站点，包括 meta 标签、搜索和页面时间戳。
  </Card>

  <Card title="Schema 参考" icon="<svg xmlns=&#x22;http://www.w3.org/2000/svg&#x22; viewBox=&#x22;0 0 24 24&#x22; fill=&#x22;none&#x22;><path d=&#x22;M16 6.99998L19.0664 9.64296C20.3554 10.7541 21 11.3096 21 12C21 12.6903 20.3555 13.2459 19.0664 14.357L16 17&#x22; stroke=&#x22;currentColor&#x22; stroke-linecap=&#x22;round&#x22; stroke-linejoin=&#x22;round&#x22; stroke-width=&#x22;1.5&#x22;/><path d=&#x22;M8 6.99998L4.93365 9.64296C3.64455 10.7541 3 11.3096 3 12C3 12.6903 3.64455 13.2459 4.93365 14.357L8 17&#x22; stroke=&#x22;currentColor&#x22; stroke-linecap=&#x22;round&#x22; stroke-linejoin=&#x22;round&#x22; stroke-width=&#x22;1.5&#x22;/></svg>" href="/zh/organize/settings-reference">
    所有 `docs.json` 属性的完整参考。
  </Card>
</CardGroup>

<div id="split-configuration-with-ref">
  ## 使用 `$ref` 拆分配置 [#使用-ref-拆分配置]
</div>

随着配置的增长，你可以使用 `$ref` 引用将 `docs.json` 拆分成更小的文件。每个引用指向一个独立的 JSON 文件，在构建时进行解析。

在 `docs.json` 中的任何位置添加一个带有相对文件路径的 `$ref` 属性。Mintlify 会将 `$ref` 对象替换为被引用文件的内容。

```json title="docs.json"
{
  "$schema": "https://mintlify.com/docs.json",
  "theme": "mint",
  "name": "Acme Docs",
  "colors": {
    "primary": "#1a73e8"
  },
  "navigation": {
    "$ref": "./config/navigation.json"
  }
}
```

```json title="config/navigation.json"
{
  "groups": [
    {
      "group": "Get started",
      "pages": ["index", "quickstart"]
    },
    {
      "group": "Guides",
      "pages": ["guides/first-steps", "guides/advanced"]
    }
  ]
}
```

* 被引用的文件可以包含自己的 `$ref` 引用。嵌套路径相对于包含它们的文件解析，而不是相对于 `docs.json`。
* 引用必须指向有效的 JSON 文件。
* 路径必须是相对路径，且保持在项目根目录内。不允许路径遍历（例如 `../../outside`）。
* 循环引用会导致构建错误。

<div id="merging-sibling-keys">
  ### 合并兄弟键 [#合并兄弟键]
</div>

如果 `$ref` 解析为对象，Mintlify 会将同一块中的兄弟键合并到引用内容之上，使这些键优先于引用中的匹配键。如果 `$ref` 解析为非对象值（如数组），Mintlify 会忽略任何兄弟键。

```json title="docs.json"
{
  "appearance": {
    "$ref": "./config/appearance.json",
    "strict": true
  }
}
```

## 从 `mint.json` 升级 [#从-mintjson-升级]

如果你的项目使用已弃用的 `mint.json` 文件，请使用 [CLI](/zh/cli) 升级到 `docs.json`。

<Steps>
  <Step title="安装或更新 CLI">
    如果你还没有安装 [CLI](/zh/cli/install)，现在安装它：

    <CodeGroup>
      <CodeBlockTabs defaultValue="npm" groupId="npm+pnpm+yarn">
        <CodeBlockTabsList>
          <CodeBlockTabsTrigger value="npm">
            npm
          </CodeBlockTabsTrigger>

          <CodeBlockTabsTrigger value="yarn">
            yarn
          </CodeBlockTabsTrigger>

          <CodeBlockTabsTrigger value="pnpm">
            pnpm
          </CodeBlockTabsTrigger>
        </CodeBlockTabsList>

        <CodeBlockTab value="npm">
          ```bash  
          npm i -g mint
          ```
        </CodeBlockTab>

        <CodeBlockTab value="yarn">
          ```bash  
          yarn global add mint
          ```
        </CodeBlockTab>

        <CodeBlockTab value="pnpm">
          ```bash  
          pnpm add -g mint
          ```
        </CodeBlockTab>
      </CodeBlockTabs>
    </CodeGroup>

    如果你已经安装了 CLI，确保它是最新版本：

    ```bash
    mint update
    ```
  </Step>

  <Step title="创建你的 docs.json 文件">
    在你的文档仓库中运行：

    ```bash
    mint dev
    ```

    此命令会从你现有的 `mint.json` 创建一个 `docs.json` 文件。检查生成的文件以确保所有设置正确。
  </Step>

  <Step title="删除你的 mint.json 文件">
    在确认 `docs.json` 配置正确后，你可以安全地删除旧的 `mint.json` 文件。
  </Step>
</Steps>
