(Sorry if this is a duplicate; I did search.)
Steps to replicate the issue
- Start with a namespace in which $wgNamespacesWithSubpages is set to false, e.g. English Wikipedia
- Find a page with a forward slash in its title, AND where the first part of the title (before the forward slash) has a separate page that has a talk page:
e.g. take https://en.wikipedia.org/wiki/Providence/Stoughton_Line if we chop off the title after the slash we go to https://en.wikipedia.org/wiki/Providence, and that has a talk page at https://en.wikipedia.org/wiki/talk:Providence
OK, that's a good example.
Now go to the talk page for the first page, e.g. https://en.wikipedia.org/wiki/Talk:Providence/Stoughton_Line
What happens?:
MediaWiki thinks that https://en.wikipedia.org/wiki/Talk:Providence/Stoughton_Line is a subpage of https://en.wikipedia.org/wiki/Talk:Providence because $wgNamespacesWithSubpages is true for talk: namespace.
So MediaWiki includes a backlink here:
{F66740127}
What should have happened instead?:
The backlink shouldn't have been there. So, we need a way to turn off the backlink.
Let's consider the logic here:
The current logic is something like this:
- The talk page is in a namespace where $wgNamespacesWithSubpages = true.
- The talk page's page name has a forward slash in it. Let's continue using talk:Foo/bar as an example:
- There exists a page at talk:Foo
But this could be altered to only show in the following circumstances:
- The talk page is in a namespace where $wgNamespacesWithSubpages = true
- The talk page's page name has a forward slash in it. Let's again continue using talk:Foo/bar as an example:
- There exists a page at talk:Foo
- The talk page DOESN'T HAVE a content page Foo/bar. (If the talk page were a record of archived discussions (e.g. talk:foo/archive_1, it would not logically have a page at Foo/archive_1). This can be checked with ifexist().
In these specific circumstances, no backlink should be displayed if the page isn't a subpage.
These logical conditions can all be tested for, so the default behaviour is fixable.
Note that we might have to deal with subsubpages, and subsubsubpages, etc. So, this would have to be checked for each level down.