> 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/wen-dang-ji-dai-ma/git-sync/content-configuration.md).

# 内容配置

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

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

```yaml
root: ./

structure:
  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" %}
在单仓库仓库中， `root` 会相对于同步部分的 Project directory 进行解析，而不是仓库根目录。基于路径的配置仅适用于该部分的同步范围内。它不会自动让同级目录或仓库级文件夹供其他部分使用。对于多部分仓库设置，请参阅 [单仓库仓库](/docs/documentation/zh/wen-dang-ji-dai-ma/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 时， **请记住不要创建或修改 readme 文件** 通过 GitBook 的 UI 进行操作。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` 文件夹中（如果在配置文件中指定了该文件夹），否则位于仓库根目录。

如果你未指定 summary，并且 GitBook 未找到 `SUMMARY.md` 位于文档根目录的文件，GitBook 将根据文件夹结构和下面的 Markdown 文件推断目录。

{% hint style="info" %}
summary Markdown 文件是 **以下内容的镜像：** **目录** ，对应于你的 GitBook 部分。因此，即使在首次导入时未提供 summary 文件，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/wen-dang-ji-dai-ma/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.
