> For the complete documentation index, see [llms.txt](https://gitbook-open-v2-preview.gitbook.workers.dev/url/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-open-v2-preview.gitbook.workers.dev/url/gitbook.com/docs/documentation/zh/getting-started/git-sync/content-configuration.md).

# 内容配置

如果你想进一步配置 Git Sync，可以添加一个 `.gitbook.yaml` 文件到该空间同步内容的根目录中，以便告诉 GitBook 如何解析你的 Git 仓库。在单体仓库中，该文件位于该空间配置的 [项目目录](/url/gitbook.com/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" %}
在单体仓库中， `root` 会相对于同步空间的项目目录进行解析，而不是相对于仓库根目录。基于路径的配置仅适用于该空间的同步范围内。它不会自动让其他空间使用同级目录或仓库级文件夹。有关多空间仓库设置，请参阅 [单体仓库](/url/gitbook.com/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 编辑器更新内容时创建和/或更新它。

因此，你不能在你的 `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:

```
GET https://gitbook-open-v2-preview.gitbook.workers.dev/url/gitbook.com/docs/documentation/zh/getting-started/git-sync/content-configuration.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
