> 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/creating-content/blocks/heading.md).

# 标题

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

GitBook 提供三种级别的标题。标题级别 1（H1）和 2（H2）会显示在 [页面大纲中](/url/gitbook.com/docs/documentation/zh/zi-yuan/gitbook-ui.md#page-outline).

### 锚点链接

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

#### 链接到锚点

在公开内容，或只读模式下的私有内容中，你可以将鼠标悬停在标题上并点击其旁边出现的 `#` 图标。这会更新浏览器顶部栏中的 URL，因此你可以复制它在其他地方使用。

如果你想从 GitBook 空间内的某个页面链接到特定锚点，可以使用 [相对链接](/url/gitbook.com/docs/documentation/zh/creating-content/formatting/inline.md#relative-links)，这样在你更改标题时它也会随之更新，以防止链接失效。

#### 编辑锚点

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

为避免这种情况，你可以通过打开标题的 **选项菜单** <picture><source srcset="/files/QLUQj6waZRiK6FpSqrt6" media="(prefers-color-scheme: dark)"><img src="/files/e1df373962dc4830bcb786d7e5cb3cce603367d3" alt="The Options menu icon in GitBook"></picture> ，然后选择 **编辑锚点**来手动设置锚点链接。之后你可以输入想要使用的锚点链接——即使你之后更改标题本身，它也会保持为该锚点。

### Markdown 中的表示方式

GitBook 会生成经过 SEO 优化的页面，这意味着 GitBook 中的页面标题会自动在 Markdown 中表示为一级标题：

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

这意味着如果你 [将内容与 Git 同步](/url/gitbook.com/docs/documentation/zh/getting-started/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 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/creating-content/blocks/heading.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.
