> 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/chuang-jian-nei-rong/blocks/heading.md).

# 标题

向页面添加标题块，以组织内容并提升 SEO

标题有助于为你的文档建立结构——而在标题中使用关键词也有助于搜索引擎理解这种结构，从而帮助你的页面在搜索结果中排名更高。

GitBook 提供三个级别的标题。一级标题（H1）和二级标题（H2）会显示在 [页面大纲](https://gitbook.com/docs/documentation/zh/can-kao/gitbook-ui.md#page-outline).

### 锚点链接

当你向页面添加标题时，它会创建一个锚点链接。然后你可以直接链接到这些特定部分，以便将人们引导到相关信息。

#### 链接到锚点

在公开内容或只读模式下的私有内容中，将鼠标悬停在标题上并点击旁边显示的 `#` ，即可查看锚点链接。浏览器顶部栏中的 URL 会随之更新，你可以复制该 URL 并在其他地方使用。

如果要从所在分区内的页面链接到某个特定锚点，可以使用 [相对链接](https://gitbook.com/docs/documentation/zh/chuang-jian-nei-rong/formatting/inline.md#relative-links)；如果更改标题，该链接也会随之更新，以免链接失效。

#### 编辑锚点

默认情况下，锚点链接将与你标题中的文本完全一致。如果你计划在 GitBook 之外链接到该 URL，将来更改标题会导致锚点链接失效。届时该链接会将访问者带到页面顶部，而不是锚点位置。

为避免这种情况，您可以手动设置锚点链接：打开 **选项菜单** <picture><source srcset="broken://files/QLUQj6waZRiK6FpSqrt6" media="(prefers-color-scheme: dark)"><img src="https://2111890564-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNkEGS7hzeqa35sMXQZ4X%2Fuploads%2Fgit-blob-23f3e8f05326b0d239d32d28bba99c1d46f204f7%2F25_01_10_options_light.svg?alt=media" alt="The Options menu icon in GitBook"></picture> ，找到相应标题，然后选择 **编辑锚点**。之后，您可以输入想要使用的锚点链接；即使更改标题本身，该锚点也会保持不变。

#### 受保护的锚点词语

GitBook 会调整包含广告拦截器通常会屏蔽的词语的自动生成锚点。这样可以防止广告拦截器隐藏标题或破坏其链接。

例如，包含“Advertise”的标题可能会生成 `#never-a-dvertise`。包含“Advertising”的标题可能会生成 `#a-dvertising`.

链接到该标题时，请使用生成的 URL。你也可以在 **编辑锚点**.

### Markdown 表示

GitBook 会生成针对 SEO 优化的页面，这意味着 GitBook 中的页面标题会自动以一级标题的形式显示在 Markdown 中：

```markdown
# 我是页面标题
```

这意味着，如果您 [使用 Git 同步内容](https://gitbook.com/docs/documentation/zh/docs-as-code/git-sync.md)，通过编辑器添加的标题会以低一级的层级呈现：

{% code overflow="wrap" %}

```markdown
## 我的标题 1
### 我的标题 2
#### 我的标题 3
```

{% endcode %}

### 标题示例 <a href="#example-of-a-heading" id="example-of-a-heading"></a>

## 我的标题 1

### 我的标题 2

#### 我的标题 3

{% hint style="info" %}
页面标题与页面正文中的标题块彼此独立。如果你在 **页面选项**中隐藏页面标题，H1、H2 和 H3 标题仍会显示。
{% endhint %}


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://gitbook.com/docs/documentation/zh/chuang-jian-nei-rong/blocks/heading.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
