# 带锚点的链接单框

**URL:** https://meta.discourse.org/t/onebox-of-link-with-anchor/234110
**Category:** Support
**Created:** [2022年七月27日 06:52 UTC](https://meta.discourse.org/t/onebox-of-link-with-anchor/234110 "2022-07-27T06:52:18Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![Moin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/moin/32/554653_2.png) [@Moin](https://meta.discourse.org/u/Moin)
#### Post date: [2022年七月27日 06:52 UTC](https://meta.discourse.org/t/onebox-of-link-with-anchor/234110/1 "2022-07-27T06:52:18Z")

</div>

我注意到锚点链接的 onebox 出现了一个奇怪的行为。  
步骤

1. 创建一个带有锚点的帖子
2. 回复该帖子
3. 再次回复，并添加一个指向第二个标题的锚点链接

→ 预期结果：一个显示链接帖子开头的 onebox。至少，如果你在另一个帖子中发布相同的链接，会发生这种情况。但你看到的是第一个回复作为 onebox。

* * *

在此帖子中测试  
一段带有几个标题的文字

### 这是一个标题

这是标题后的文字

### 这是第二个标题

这是又一些文字

### 这是第三个标题

又是些文字

---

<div class="post-metadata">

### Author: ![Moin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/moin/32/554653_2.png) [@Moin](https://meta.discourse.org/u/Moin)
#### Post date: [2022年七月27日 06:52 UTC](https://meta.discourse.org/t/onebox-of-link-with-anchor/234110/2 "2022-07-27T06:52:39Z")

</div>

这是第二篇帖子

---

<div class="post-metadata">

### Author: ![Moin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/moin/32/554653_2.png) [@Moin](https://meta.discourse.org/u/Moin)
#### Post date: [2022年七月27日 06:53 UTC](https://meta.discourse.org/t/onebox-of-link-with-anchor/234110/3 "2022-07-27T06:53:03Z")

</div>

带有锚点链接的帖子

> [@Onebox of link with anchor](https://meta.discourse.org/t/onebox-of-link-with-anchor/234110/2#this-is-a-second-headline-2):
>
> And this is the second post

该链接指向第一篇帖子中的第二个标题，但 onebox 显示的是第二篇帖子

---

<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年七月27日 07:10 UTC](https://meta.discourse.org/t/onebox-of-link-with-anchor/234110/4 "2022-07-27T07:10:47Z")

</div>

`https://meta.discourse.org/t/onebox-of-link-with-anchor/234110#this-is-a-second-headline-2`

> [@Onebox of link with anchor](https://meta.discourse.org/t/onebox-of-link-with-anchor/234110#this-is-a-second-headline-2):
>
> I noticed a strage behavior with the onebox of an anchor link. Steps Create a topic with anchors Answer to that post Answer again with an anchor link to the second headline → Expected result a onebox showing the beginning of the linked post. At least this in what will happen if you post the same link in another topic. But you see the first answer as a onebox. Testing in this topic A text with some headlines This is a headline This is text after the headline This is a second headline T…

这很有趣。 🙂 在我的预览中，它显示了 OP 在 onebox 中。让我们看看它是否会发布出去。

**更新：** 这似乎没问题。也许与帖子编号或用户有关？我将在我的测试站点上进行探索。感谢报告 @Moin 🙂 👍

---

<div class="post-metadata">

### Author: ![Moin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/moin/32/554653_2.png) [@Moin](https://meta.discourse.org/u/Moin)
#### Post date: [2022年七月27日 07:14 UTC](https://meta.discourse.org/t/onebox-of-link-with-anchor/234110/5 "2022-07-27T07:14:45Z")

</div>

您也可以看看我在 [try.discourse.org](http://try.discourse.org) 上的尝试。

---

<div class="post-metadata">

### Author: ![Moin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/moin/32/554653_2.png) [@Moin](https://meta.discourse.org/u/Moin)
#### Post date: [2024年二月16日 20:52 UTC](https://meta.discourse.org/t/onebox-of-link-with-anchor/234110/6 "2024-02-16T20:52:07Z")

</div>

我认为这已经修复了。我无法再重现它了 [https://try.discourse.org/t/anchors-in-links/1489/3?u=moin](https://try.discourse.org/t/anchors-in-links/1489/3?u=moin)

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [2024年三月17日 20:52 UTC](https://meta.discourse.org/t/onebox-of-link-with-anchor/234110/7 "2024-03-17T20:52:27Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
