Page MenuHomePhabricator

During transclusion, Special:PrefixIndex does not apply selflink to a title when that title normally would have it applied
Open, Needs TriagePublicBUG REPORT

Description

While exploring Special:Prefixindex to describe T373254: DisplayTitle should show the displaytitle for Prefixindex+stripprefix, we put {{Special:PrefixIndex/Main_Page}} on a subpage of Main_Page and got unexpected results.

A tiny wiki with only one page, Main_Page/demo, whose content is:

{{Special:Prefixindex/Main Page/}}

[[Main Page/demo]]

The page should show

  • Main_Page/demo

Main_Page/demo

But, instead it shows

Main_Page/demo

see also: T336256: Inconsistent use of href parameter and selflink mw-selflink classes between plain links and links in images

Details

Related Changes in Gerrit:

Event Timeline

Change #1070049 had a related patch set uploaded (by MarkAHershberger; author: MarkAHershberger):

[mediawiki/core@master] Fix selflink by using parser.

https://gerrit.wikimedia.org/r/1070049

When transcluding a special page, you can think about it as using an iframe. The transclusion is merely including what the special page would have output, with some tweak such as removing the submittable form.

So as much as Special:PrefixIndex does not have a TITLE context, it does not have one either when it is being transcluded.

I think the primary use case for Special:PrefixIndex is to list subpages and I don't think there is much point in listing the root page in the listing when you are already on the root page. So that if you are on a page Book and have subpages Book/Chapter_1 and Book/Chapter_2 you would use:

{{Special:PrefixIndex/Book/|stripprefixindex=1}}

Which would exclude Book (since it does not match Book/ ) and remove the common prefix of Book/ which yields:

Chapter_1  Chapter_2

That is most probably going to be used in an infobox template. That in turns would probably be decorated with a link to Book which would not be linked when showing up on the Book page thanks to the magic of the MediaWiki parser.

Change #1070049 abandoned by Hashar:

[mediawiki/core@master] Fix selflink by using parser.

https://gerrit.wikimedia.org/r/1070049

Change #1070049 restored by Thcipriani:

[mediawiki/core@master] Fix selflink by using parser.

https://gerrit.wikimedia.org/r/1070049