Jump to content

Native support for alternative section anchors (Community Wishlist/W260)

Long-term opportunity
From Meta, a Wikimedia project coordination wiki
Translate this page; This page contains changes which are not marked for translation.

View all wishes.

Description

In order to create shorthand or stable links to sections, editors create fragment IDs (aka anchors) that point to sections that differ from the visible headings.

This can be done using {{anchor}}, as in == {{anchor|Anchor}} Heading ==, or its substituted form, == <span id="Anchor"></span> Heading ==, but the first results in bad section links—as in /* {{anchor|Anchor}} Heading */, which shows up as →{{anchor|Anchor}} Heading—while the second is less self-evident as to what it's for, especially to newcomers.

Another solution is to put the {{anchor}} or ‎<span>...‎</span> at the end of the previous section, but this doesn't show up when editing the section (and shows up at the end when editing the previous), which is quite confusing.

We need a way to add fragment IDs inside section headings that 1) communicates clearly what it's doing and 2) doesn't affect section links.

E.g. a parser function like {{#sectionanchor:Anchor name}} that can be used anywhere inside a section and results in <span id="Anchor_name"></span> prepended at the top of (or inserted before) the nearest Hn element before the function call.

Previous wishlist surveys: 2022

Assigned focus area

Unassigned

Type of wish
Feature request
Tags
Affected users

Editors

Phabricator tasks
Other details
  • Created: 08:12, 21 August 2024
  • Last updated: 10:29, 8 April 2026
  • Author: Nardog (talk)
Voting

This wish currently has 9 supporters. Voting for this wish is open until it is completed.

Supporters of this wish
Support Nardog (talk) 08:12, 21 August 2024
Support Enwiki has a style rule called en:WP:ANCHORSUBST that is being applied everywhere right now. It fixes some accessibility, mobile, and edit summary issues with anchors, but results in extremely ugly, extremely verbose wikicode. Example diff. This wish would solve that. Novem Linguae (talk) 13:40, 14 December 2025
Support Yeah, that would be helpful, the current syntax is unreadable and unintuitive. Gawaon (talk) 14:33, 14 December 2025
Support Oh please, do something about section link rot, that's such a pain in the ass. When I see a section link in an article, I immediately suspect that it won't be working and really often end up being right. There should be an automatic mechanism in place to make sure anchor links don't break as the articles develop. This proposal seems to be a good one. JWBTH (talk) 15:00, 14 December 2025
Support Badly needed. With the source editor, the uninitiated may think they're seeing stray markup that doesn't belong on Wikipedia. Worse, with Visual Editor, the anchor doesn't appear at all and editing the header can delete the anchor, quite unknowingly (e.g. [1]). NebY (talk) 15:03, 17 December 2025
Support This would prevent a lot of problems. It would be great if it could work as JWBTH suggests. I followed a link here from Wikipedia talk:Manual of Style. (talk) 18:23, 14 December 2025 (UTC) SchreiberBike (talk) 18:25, 14 December 2025
Support Yes please! en:WP:ANCHORSUBST is so messy! FaviFake (talk) 18:28, 17 December 2025
Support Second @NebY and @JWBTH re: section anchor maintenance and link rot. Fixing section link rot would require additional tooling to flag edits that break incoming section links. Preimage (talk) 15:09, 30 January 2026
Support Absolutely. ANCHORSUBST is ugly. Let's get rid of that. HouseBlaster (talk) 06:46, 7 February 2026