Page MenuHomePhabricator

Back redirects should be wrapped with CSS span.
Open, Needs TriagePublic

Description

[[Foo]] contains a link to president [[Bar]]. [[Bar]] somehow gets turned into a redirect back to [[Foo]].

While browsing [[Foo]], a user who clicks on the blue [[Bar]] link gets bounced from [[Bar]] back to [[Foo]]. This reader experience can be confusing and disorienting. Let's call these back redirects.

Discussion at https://en.wikipedia.org/wiki/Wikipedia:Village_pump_%28technical%29#Cyclic_redirects:_Avoid_misleading_the_reader

Issues*

First, we don't know how many pages this affects. There is no maintenance report - T402483: Special page at Special:RedirectsBacktoPages to identify redirects back to pages would fix that.

If that is fixed, then it's then a case, on page rendering, of checking whether the page being rendered is mentioned in the maintanance report. If it is mentioned then CSS span class should be thrown around the offending link. This can be used to change the into a different colour, or maybe even remove the link entirely (which might be a better suggestion - discuss).

We might also look to throw an error message on page preview noting the presence of the back-link within the page, similar to T394016: Check edit constraints on page preview.

T18562: Make links to section redirects that point back to the same page easily distinguishable specifically notes section links. These might be dealt with separately; ideally rendered similar to a link like [[#foobar]] that doesn't force page reload.

Event Timeline

Alsee raised the priority of this task from to Needs Triage.
Alsee updated the task description. (Show Details)
Alsee subscribed.
Krenair claimed this task.
Krenair subscribed.

article exists as a redirect != article does not exist

SebastianHelm subscribed.

While it is of course true that "article exists as a redirect != article does not exist", it does not logically follow that this request is "invalid". In fact, this request addresses a real existing problem, which is, as @Alsee writes, "confusing to the point of upsetting" and therefore merits consideration.

When I said that a redlink indicates that an article does not exist, I meant that from the reader's perspective. There is no article on Bob, and the redirect doesn't point to some useful alternate article.

Aklapper set Security to None.
Jackmcbarn renamed this task from Redirect link from=to to It should be apparent when a link on a page redirects back to the same page.Jan 1 2016, 11:18 PM
Jackmcbarn edited projects, added: MediaWiki-Parser; removed: MediaWiki-Page-editing.
Jackmcbarn subscribed.

https://en.wikipedia.org/wiki/User:Anomie/linkclassifier.js can add the class "self-redirect" to such links (which can then be styled with CSS), though I agree this would be nice to have in core.

With Page Previews on mouse-hover (introduced 2017-ish) this issue is semi-mitigated but continues to be an issue. It can still take many seconds to understand that the preview shown is for the very page you're reading. And if anything, the preview demonstrates that Wikipedia knows the link redirects back to this page, but is not smart enough to do anything about it.

Another issue not mentioned here is when pages redirect to subsections - ideally such cases could show the user which section they'd end up in if they clicked (in the target URL shown in the status bar of most browsers) and save an unnecessary reload of the article as an added bonus.

An example page: https://en.wikipedia.org/wiki/Plane_(Unicode)#Overview (permalink) which transcludes https://en.wikipedia.org/wiki/Template:Planes_(Unicode) (permalink)

The table row for plane names (starting "Basic Multilingual Plane") has links directly to other sections of Plane (Unicode), except for "Supplement­ary Special-purpose Plane" which links to its own page - which then redirects back to a section of Plane (Unicode). Because it goes through a redirect, I can't tell which section is being linked unless I click through, whereas I can with the other links in the same row.

This is a fairly benign example, but there are certainly more confusing cases out there.

P.S. I realize that this is the worst possible time to resurface issues like this, with Vector 2022 going public just yesterday and the influx of activity centered around that. Hope this doesn't get buried due to that, but if so, so be it!

For convenience, the discussion from 2015-2016 mentioned in the original description can be found here: https://en.wikipedia.org/wiki/Wikipedia:Village_pump_(technical)/Archive_142#Cyclic_redirects:_Avoid_misleading_the_reader

Somehow in my searching I didn't come across this request, and created T400734. Thank you Pppery for helping me get here. =)

I do think this would be very useful in so far as article maintenance goes for editors and readers for multiple reasons:

  1. On en.WP we currently have MOS:BOLDREDIRECT which basically mimics the bolded self-ref behavior that literally linking to a page from itself already does (this is done to make it easier for a reader to find the redirect topic without scanning paragraphs of text); presumably this ticket would reproduce that self-ref behavior and make the manual bolding unnecessary
  2. By using [[link]] text, if the redirect should one day be made into an actual article, the articles linking would simply work automatically
  3. It would be less confusing for our readers

The solution provided by @Alsee above suggests a link with a different color. I propose simply treating it as a link to itself would be treated (that is, not generating a link and bolding the link/piped text as appropriate). Perhaps a Preference to generate a link for logged-in users, but readers are usually not going to be interested in clicking links that take them in circles. For the logged-in link, orange or dark yellow would work.

T402483: Special page at Special:RedirectsBacktoPages to identify redirects back to pages would create a special page that identified these, which would not solve the issue, but make it easier to identify when it occurs.

How does MediaWiki-extensions-Disambiguator identify disambiguation pages @kaldari ? I presume it makes a list (in Special:DisambiguationPages) and then on page rendering checks any links against the list -- is that right?

If that is the case, it makes a model that this can follow, if T402483: Special page at Special:RedirectsBacktoPages to identify redirects back to pages can generate the a of back redirects, then on page rendering a quick check can be run to see if any the page being edited is on the list (note it might appear more than once, with different links), and then identify exactly which links on the page are problematic, and throw a CSS class around them.

Bugreporter2 renamed this task from It should be apparent when a link on a page redirects back to the same page to Back-links to the same page should.Feb 4 2026, 8:57 AM
Bugreporter2 renamed this task from Back-links to the same page should to Back-links to the same page should be wrapped with CSS span..
Bugreporter2 renamed this task from Back-links to the same page should be wrapped with CSS span. to Back redirects should be wrapped with CSS span..
Bugreporter2 updated the task description. (Show Details)

If it is obvious which code repository must be updated, could someone please direct me to it so that I may take a look?

If it is obvious which code repository must be updated, could someone please direct me to it so that I may take a look?

Hi @TPI81AF

The Gerrit site is the main code repository and is at https://gerrit.wikimedia.org/r/

You should also take a look at the guide at https://www.mediawiki.org/wiki/New_Developers

Note this task might be a little tricky if you don't have programming experience. You might want to start with something in good first task instead.