# 某些TOC主题中缺少锚定链接？

**URL:** https://meta.discourse.org/t/missing-anchor-links-in-certain-toc-topics/282326
**Category:** Support
**Tags:** disco-toc
**Created:** [2022年六月21日 15:51 UTC](https://meta.discourse.org/t/missing-anchor-links-in-certain-toc-topics/282326 "2022-06-21T15:51:44Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![RGJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/rgj/32/523185_2.png) [@RGJ](https://meta.discourse.org/u/RGJ)
#### Post date: [2022年六月21日 15:51 UTC](https://meta.discourse.org/t/missing-anchor-links-in-certain-toc-topics/282326/1 "2022-06-21T15:51:44Z")

</div>

我似乎缺少标题旁边的锚链接，这允许我直接链接到特定部分，例如在此主题中，如初始帖子中所述：

> [@Johani](#):
>
> 完成所有这些之后，它还将为每个按钮添加一个链接，直接链接到该部分：
> 
> ![Untitled](https://global.discourse-cdn.com/meta/original/3X/e/0/e0fbf615c3df122542b87de65004672939c231cd.png)

这是我的问题还是此功能消失了？

---

<div class="post-metadata">

### Author: ![JammyDodger](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jammydodger/32/254611_2.png) [@JammyDodger](https://meta.discourse.org/u/JammyDodger)
#### Post date: [2022年六月21日 15:55 UTC](https://meta.discourse.org/t/missing-anchor-links-in-certain-toc-topics/282326/2 "2022-06-21T15:55:18Z")

</div>

他们应该在那里？我现在用的是手机，但我通过长按标题旁边的空白处来获取这个：

[https://meta.discourse.org/t/discotoc-automatic-table-of-contents/111143#how-does-it-work-3](https://meta.discourse.org/t/discotoc-automatic-table-of-contents/111143#how-does-it-work-3)

---

<div class="post-metadata">

### Author: ![RGJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/rgj/32/523185_2.png) [@RGJ](https://meta.discourse.org/u/RGJ)
#### Post date: [2022年六月21日 19:58 UTC](https://meta.discourse.org/t/missing-anchor-links-in-certain-toc-topics/282326/3 "2022-06-21T19:58:27Z")

</div>

是的，该主题包含那些锚点链接，但该主题没有 DiscoTOC。

但是，此主题包含一个目录但没有锚点：[https://meta.discourse.org/t/beginners-guide-to-using-discourse-themes/91966，而这个主题也没有锚点：https://meta.discourse.org/t/discourseconnect-official-single-sign-on-for-discourse-sso/13045](https://meta.discourse.org/t/beginners-guide-to-using-discourse-themes/91966%EF%BC%8C%E8%80%8C%E8%BF%99%E4%B8%AA%E4%B8%BB%E9%A2%98%E4%B9%9F%E6%B2%A1%E6%9C%89%E9%94%9A%E7%82%B9%EF%BC%9Ahttps://meta.discourse.org/t/discourseconnect-official-single-sign-on-for-discourse-sso/13045)

编辑 嗯……这个主题_确实_有锚点：[Discourse REST API Documentation](https://meta.discourse.org/t/discourse-api-documentation/22706)

---

<div class="post-metadata">

### Author: ![pmusaraj](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pmusaraj/32/119489_2.png) [@pmusaraj](https://meta.discourse.org/u/pmusaraj)
#### Post date: [2022年六月21日 19:58 UTC](https://meta.discourse.org/t/missing-anchor-links-in-certain-toc-topics/282326/4 "2022-06-21T19:58:49Z")

</div>

啊，我可以解释一下。您链接的主题中有 HTML 标题（`<h3>`、`<h4>` 等），最初 TOC 组件有自己的添加标题锚点的逻辑。但是，此后，核心添加了自动锚点，最近我删除了主题组件中的自定义锚点登录。但是，核心的锚点功能仅适用于 Markdown 标题（使用 `###`）。

所以 OP 这里有锚点，但[链接的指南](https://meta.discourse.org/t/beginners-guide-to-using-discourse-themes/91966)没有。

我们可能应该更新该指南，使其使用 Markdown 而不是 HTML @JammyDodger。

---

<div class="post-metadata">

### Author: ![RGJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/rgj/32/523185_2.png) [@RGJ](https://meta.discourse.org/u/RGJ)
#### Post date: [2022年六月21日 20:01 UTC](https://meta.discourse.org/t/missing-anchor-links-in-certain-toc-topics/282326/5 "2022-06-21T20:01:19Z")

</div>

啊！这完美地解释了一切，谢谢 Penar！！

---

<div class="post-metadata">

### Author: ![JammyDodger](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jammydodger/32/254611_2.png) [@JammyDodger](https://meta.discourse.org/u/JammyDodger)
#### Post date: [2022年六月22日 10:00 UTC](https://meta.discourse.org/t/missing-anchor-links-in-certain-toc-topics/282326/6 "2022-06-22T10:00:32Z")

</div>

昨天我显然不够专心。 🙂 我现在已经将两个示例主题的 Markdown 标题进行了替换。 👍

---

<div class="post-metadata">

### Author: ![RGJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/rgj/32/523185_2.png) [@RGJ](https://meta.discourse.org/u/RGJ)
#### Post date: [2023年十月16日 07:35 UTC](https://meta.discourse.org/t/missing-anchor-links-in-certain-toc-topics/282326/7 "2023-10-16T07:35:50Z")

</div>

此主题在上次回复后 30 天自动关闭。不再允许回复。
