Onebox of link with anchor

AI-generated summary

A user, Moin, encountered an issue with oneboxing anchor links. When linking to a specific headline within a post, the onebox displayed the first answer instead of the linked post. Moin provided steps to reproduce the issue and tested it in the topic. JammyDodger attempted to replicate the issue and found it only occurred when previewing, not when posting. Moin later reported that the issue was fixed and could no longer be reproduced, even on a test site (try.discourse.org).

I noticed a strage behavior with the onebox of an anchor link.
Steps

  1. Create a topic with anchors
  2. Answer to that post
  3. 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

This is again some text

This is a third headline

And again some text

And this is the second post

And the post with the anchor link

The link directs to the second headline in the first post, but the onebox shows the second post

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

This is a fun one. :slight_smile: In my preview it’s showing the OP in the onebox. Let’s see if it travels through to posting.

Update: That seemed to work okay. Perhaps something to do with the post number or user? I shall have an explore on my test site. Thanks for reporting @Moin :slight_smile: :+1:

You can also have a look at my tries at try.discourse.org

I think this was fixed. I cannot reproduce it anymore https://try.discourse.org/t/anchors-in-links/1489/3?u=moin