> For the complete documentation index, see [llms.txt](https://gitbook.com/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://gitbook.com/docs/documentation/zh/getting-started/git-sync/content-configuration.md).

# 内容配置

如果你想进一步配置 Git Sync，可以添加一个 `.gitbook.yaml` 文件，放在该部分同步内容的根目录中，以便告诉 GitBook 如何解析你的 Git 仓库。在 monorepo 中，该文件位于该部分配置的 [项目目录](/docs/documentation/zh/getting-started/git-sync/monorepos.md).

{% code title=".gitbook.yaml" %}

```yaml
root: ./

结构：
  readme: README.md
  summary: SUMMARY.md

redirects:
  previous/page: new-folder/page.md
```

{% endcode %}

### 根目录

用于查找文档的路径默认是仓库的根目录。下面是如何让 GitBook 查看一个 `./docs` 文件夹：

{% code title=".gitbook.yaml" %}

```yaml
root: ./docs/
```

{% endcode %}

{% hint style="warning" %}
**所有其他指定路径的选项都将相对于此根文件夹**。因此，如果你将 root 定义为 `./docs/` ，然后 `structure.summary` 为 `./product/SUMMARY.md`，GitBook 实际上会在 `./docs/product/SUMMARY.md`.‌
{% endhint %}

{% hint style="info" %}
在 monorepo 中， `root` 会相对于同步部分的项目目录解析，而不是仓库根目录。基于路径的配置仅适用于该部分的同步范围内。它不会自动让其他部分访问同级目录或仓库级文件夹。有关多部分仓库设置，请参见 [单仓库项目](/docs/documentation/zh/getting-started/git-sync/monorepos.md).
{% endhint %}

### 结构 <a href="#structure" id="structure"></a>

该结构接受两个属性：

* **`readme`**：你的文档首页。默认值为 `./README.md`
* **`summary`**：你的文档目录。默认值为 `./SUMMARY.md`

这些属性的值是相应文件的路径。路径相对于“root”选项。例如，下面是如何让 GitBook 查看一个 `./product` 文件夹中的首页和目录：

{% code title=".gitbook.yaml" %}

```yaml
structure:
  readme: ./product/README.md
  summary: ./product/SUMMARY.md
```

{% endcode %}

{% hint style="warning" %}
启用 Git Sync 后， **记得不要通过** GitBook 的 UI 创建或修改 readme 文件。readme 文件应仅在你的 GitHub/GitLab 仓库中管理，以避免冲突和重复问题。
{% endhint %}

### 目录 <a href="#summary" id="summary"></a>

该 `summary` 文件是一个 Markdown 文件（`.md`），应具有以下结构：

{% code title="./SUMMARY.md" %}

```markdown
# 目录

## 使用标题创建像这样的页面组

* [第一页标题](page1/README.md)
    * [某个子页面](page1/page1-1.md)
    * [另一个子页面](part1/page1-2.md)

* [第二页标题](page2/README.md)
    * [某个子页面](page2/page2-1.md)
    * [另一个子页面](part2/page2-2.md)

## 第二页组

* [另一个页面](another-page.md)
```

{% endcode %}

提供自定义目录文件是可选的。默认情况下，GitBook 会查找名为 `SUMMARY.md` 的文件，在你的 `root` 文件夹中（如果配置文件中指定了该文件夹），否则就在仓库根目录中。

如果你不指定目录，且 GitBook 没有在你的文档根目录中找到一个 `SUMMARY.md` 文件，GitBook 将根据文件夹结构以及下面的 Markdown 文件推断目录。

{% hint style="info" %}
目录 Markdown 文件是 **……的镜像** **目录** ，对应于你的 GitBook 部分。因此，即使在初始导入时未提供目录文件，GitBook 也会在你使用 GitBook 编辑器更新内容时创建一个和/或更新它。

因此，在你的 `SUMMARY.md` 文件中无法两次引用同一个 Markdown 文件，因为这会意味着在你的 GitBook 部分中，一个页面对应两个不同的 URL。
{% endhint %}

#### 目录（侧边栏）标题 <a href="#sidebar-titles" id="sidebar-titles"></a>

如果你希望页面在目录侧边栏中的标题与页面本身不同，你可以定义一个可选的 **页面链接标题** 的文件，在你的 `SUMMARY.md` 文件。

如果你正在使用 Git Sync，页面链接标题设置在页面链接上：

{% code title="./SUMMARY.md" %}

```markdown
# 目录

* [页面主标题](page.md "页面链接标题")
```

{% endcode %}

引号中的文本（`"页面链接标题"`）将会被用于：

* 在目录（侧边栏）中
* 在每个页面底部的分页按钮中
* 在你添加到该页面的任何相对链接中

页面链接标题是可选的——如果你不手动添加，GitBook 默认会在所有地方使用页面的标准标题。


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://gitbook.com/docs/documentation/zh/getting-started/git-sync/content-configuration.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
