# Improve oneboxing for anchored links

**URL:** https://meta.discourse.org/t/improve-oneboxing-for-anchored-links/240699
**Category:** Feature
**Tags:** onebox
**Created:** [October 3, 2022, 8:22am UTC](https://meta.discourse.org/t/improve-oneboxing-for-anchored-links/240699 "2022-10-03T08:22:41Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![adrelanos](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/adrelanos/32/121409_2.png) [@adrelanos](https://meta.discourse.org/u/adrelanos)
#### Post date: [October 3, 2022, 8:22am UTC](https://meta.discourse.org/t/improve-oneboxing-for-anchored-links/240699/1 "2022-10-03T08:22:41Z")

</div>

For example when the topic was `constructible polygon` I post a link to `https://en.wikipedia.org/wiki/Constructible_polygon` then the oneboxing looks nice and very useful.

> **[Constructible polygon](https://en.wikipedia.org/wiki/Constructible_polygon)**
>
> In mathematics, a constructible polygon is a regular polygon that can be constructed with compass and straightedge. For example, a regular pentagon is constructible with compass and straightedge while a regular heptagon is not. There are infinitely many constructible polygons, but only 31 with an odd number of sides are known.
> Some regular polygons are easy to construct with compass and straightedge; others are not. The ancient Greek mathematicians knew how to construct a regular polygon with 3,...

In above case, the onebox has a lot of value.

However, if the topic was about about something more specific such as `Compass and straightedge constructions` which requires an anchored link, the adding a link to `https://en.wikipedia.org/wiki/Constructible_polygon#Compass_and_straightedge_constructions` is much less useful.

Could this be improved somehow?

Ideas:

- When `#` is in the link, ask the user if a onebox should be generated while typing?
- Drop the generic image from `og:image` meta tag?
- Add an image form that specific (wiki) chapter contained in the `#` anchored link, if any?
- Add the title of the (wiki) specific chapter instead of the title of the (wiki) page (`og:title`)?

---

<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: [October 3, 2022, 9:33am UTC](https://meta.discourse.org/t/improve-oneboxing-for-anchored-links/240699/2 "2022-10-03T09:33:08Z")

</div>

I think we have special handling for the Wikipedia ones that do link to the anchors?

> **[Constructible polygon | Compass and straightedge constructions](https://en.wikipedia.org/wiki/Constructible_polygon#Compass_and_straightedge_constructions)**
>
> Compass and straightedge constructions are known for all known constructible polygons. If n = pq with p = 2 or p and q coprime, an n-gon can be constructed from a p-gon and a q-gon.
> 1.If p = 2, draw a q-gon and bisect one of its central angles. From this, a 2q-gon can be constructed. |
> 2.If p \> 2, inscribe a p-gon and a q-gon in the same circle in such a way that they share a vertex. Because p and q are coprime, there exist integers a and b such that ap + bq = 1. Then 2aπ/q + 2bπ/p = 2π/pq. Fro...

Though looking at it, the image does appear to be the same, but it picks up the chapter title and paragraph.

---

<div class="post-metadata">

### Author: ![nyxnor](https://avatars.discourse-cdn.com/v4/letter/n/e495f1/32.png) [@nyxnor](https://meta.discourse.org/u/nyxnor)
#### Post date: [October 3, 2022, 12:25pm UTC](https://meta.discourse.org/t/improve-oneboxing-for-anchored-links/240699/3 "2022-10-03T12:25:42Z")

</div>

The following link doesn’t work as expected with oneboxing for example:

`https://www.whonix.org/wiki/Onion_Services#cite_note-11`

> **[Onion Services](https://www.whonix.org/wiki/Onion_Services#cite_note-11)**
>
> Install package(s) libapache2-mod-removeip following these instructions: | Anonymously host any server with Whonix and Tor onion services

---

<div class="post-metadata">

### Author: ![adrelanos](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/adrelanos/32/121409_2.png) [@adrelanos](https://meta.discourse.org/u/adrelanos)
#### Post date: [October 4, 2022, 4:33pm UTC](https://meta.discourse.org/t/improve-oneboxing-for-anchored-links/240699/4 "2022-10-04T16:33:43Z")

</div>

> [@JammyDodger](#):
>
> I think we have special handling for the Wikipedia ones that do link to the anchors?

Interesting. I am surprised by that. So I didn’t choose my example wisely. 🙂

It works for wikimedia (which is based on mediawiki) but doesn’t seem to work for other websites based on mediawiki or other websites with anchors?

---

<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: [December 10, 2025, 8:26pm UTC](https://meta.discourse.org/t/improve-oneboxing-for-anchored-links/240699/5 "2025-12-10T20:26:35Z")

</div>

I think this was improved in [FEATURE: Enhance onebox descriptions with URL fragment/anchor context by IanButterworth · Pull Request #36536 · discourse/discourse · GitHub](https://github.com/discourse/discourse/pull/36536)

Your example `https://www.whonix.org/wiki/Onion_Services#cite_note-11` now looks like this:

> **[Onion Services](https://www.whonix.org/wiki/Onion_Services#cite_note-11)**
>
> Install package(s) libapache2-mod-removeip following these instructions: | Anonymously host any server with Whonix and Tor onion services

Without the anchor it’s still

> **[Onion Services](https://www.whonix.org/wiki/Onion_Services)**
>
> Anonymously host any server with Whonix and Tor onion services
