Oneboxes with anchors hide the anchor

AI-generated summary

The Onebox feature has an issue with anchors, where the main link strips the anchor, causing users to lose context when linking to specific comments on GitHub pages with many comments. mbauman suggests preserving the anchor in the main link. Additionally, they request special anchor support for GitHub comments, similar to the existing support for Wikipedia. joffreyjaffeux mentions that recent improvements to this feature are available on tests-passed and invites feedback on their effectiveness.

When I write a onebox with an anchor — for example to a particular comment in a GitHub issue — the generated onebox has multiple links:

https://github.com/discourse/discourse/pull/7666#issuecomment-497742621

The diminutive top one (in gray; the github.com/discourse/discourse text) preserves the anchor but the obvious big blue link strips it. I get that without special support, the onebox is describing the page itself, but I wrote an anchor tag and I’d like most folks that click it to go to the anchor. Sure, when there’s just a handful of comments it’s not huge, but if you’re trying to link into the middle of a complicated issue the lost context is a bigger deal.

A secondary feature request would be to add special anchor support for GitHub comments as you’ve done for Wikipedia (note that the generated oneboxes in that old topic are confusing because Wikipedia’s page structure has since changed so it does still work):

4 Likes

@nbianca recently pushed various improvements to this, it’s now available on tests-passed. Lets us know how it works for you.

2 Likes

This topic was automatically closed after 2 days. New replies are no longer allowed.