---
title: 标题
description: 使用 H2 和 H3 标题组织页面，自动填充右侧目录并生成可分享的锚点链接。
---

> **For AI agents:** the complete documentation index is at [llms.txt](/docs/llms.txt). Append `.md` to any page URL for its markdown version.

Markdown 标题（`##`、`###`）可将页面划分为便于读者快速浏览的章节。Jamdesk 会识别 H2 和 H3 标题以生成右侧 **Table of Contents**，并创建可直接分享的锚点链接。

## 基本用法

使用标准 Markdown 标题组织内容：

```markdown
## Section Title

Content goes here...

### Subsection

More detailed content...
```

H2 和 H3 标题会显示在右侧 **Table of Contents** 中，读者可在长页面的不同章节之间跳转。

## 锚点链接

每个标题都会根据其文本自动生成锚点 ID：

| 标题                    | 生成的锚点       |
| ------------------------- | ---------------------- |
| `## Getting Started`      | `#getting-started`     |
| `## API Reference`        | `#api-reference`       |
| `### User Authentication` | `#user-authentication` |

### 分享标题链接

将鼠标悬停在任意 H2 或 H3 标题上，可显示 **link icon**。这样可以轻松分享指向特定章节的直接链接：

- **Click the link icon** 可将 URL 复制到剪贴板
- **Click the header text** 可复制 URL 并导航至该章节

link icon 显示在标题左侧的小型带边框方框中。复制链接时，图标会短暂变色以确认操作。

<Note>
  在移动设备上，link icon 会被隐藏，因为没有悬停状态。
  标题仍可正常用于导航。
</Note>

### 链接到标题

使用锚点从其他页面引用特定章节：

```markdown
See the [headings section](/content/mdx-basics#headings) for details.
```

## 最佳实践

<AccordionGroup>
  <Accordion title="使用清晰的层级结构" icon="sitemap" defaultOpen>
    主章节使用 H2，子章节使用 H3：

    ```markdown
    ## Installation

    ### Prerequisites

    ### Quick Install

    ## Configuration

    ### Basic Options

    ### Advanced Options
    ```

    避免跳过层级（例如从 H2 直接跳到 H4）。

  </Accordion>

  <Accordion title="保持标题简洁" icon="text-width">
    简短的标题更易于浏览：

    ```markdown
    {/* Good */}
    ## Authentication

    {/* Avoid */}
    ## How to Set Up Authentication in Your Application
    ```

  </Accordion>

  <Accordion title="使用句首大写" icon="font">
    仅将第一个单词和专有名词大写：

    ```markdown
    {/* Good */}
    ## Getting started with the API

    {/* Avoid */}
    ## Getting Started With The API
    ```

  </Accordion>
</AccordionGroup>

## 后续内容

<Columns cols={2}>
  <Card title="SEO 优化" icon="magnifying-glass-chart" href="/cn/content/seo">
    改善内容发现和元数据
  </Card>
  <Card title="前置元数据" icon="file-lines" href="/cn/content/frontmatter">
    定义标题、描述和 SEO 字段
  </Card>
</Columns>