# 锚点链接转到未发布页面的主题

**URL:** <https://meta.discourse.org/t/anchor-links-go-to-topic-not-published-page-content/288398>\
**Category:** Product Support\
**Created:** [2023 年12 月 12 日 16:43 UTC](https://meta.discourse.org/t/anchor-links-go-to-topic-not-published-page-content/288398 "2023-12-12T16:43:25Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

作者： ![merefield](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/merefield/32/176214_2.png) [@merefield](https://meta.discourse.org/u/merefield)\
发布日期： [2023 年12 月 12 日 18:13 UTC](https://meta.discourse.org/t/anchor-links-go-to-topic-not-published-page-content/288398/2 "2023-12-12T18:13:25Z")

</div>

好的，这是让它们在\_两个\_地方都生效的方法 🦚

1. 像平常一样将标题设置为基本标题，这里我将使用一个示例：

```plaintext
## Keep It Tidy
blah blah blah

## This is a Civilized Place for Public Discussion
foo foo bar

## Improve the Discussion
blah foo rah

```

1. 然后进一步编辑主题页面，在顶部创建一个目录部分。

```plaintext
## Contents

<a>Keep it Tidy</a>
<a>This is a Civilized Place for Public Discussion</a>
<a>Improve the Discussion</a>

```

1. 现在像平常一样查看主题页面，然后转到每个链接并复制链接。

- 将每个链接放在该特定项目的 `href` 引号之间，但是，这是关键部分，\_只\_关心 `#` 部分。

- 所以你最终会得到类似这样的东西：

```plaintext
<a href="#keep-it-tidy-2">Keep it Tidy</a>
<a href="#this-is-a-civilized-place-for-public-discussion-3">This is a Civilized Place for Public Discussion</a>
<a href="#improve-the-discussion-4">Improve the Discussion</a>

```

1. 现在这应该可以在主题页面\_和\_已发布的页面上\_都\_生效。

🎉

---

_[View the full topic](https://meta.discourse.org/t/anchor-links-go-to-topic-not-published-page-content/288398)._
