Page MenuHomePhabricator

Transclusion should produce tree-like results in "What links here"
Open, LowPublicFeature

Assigned To
None
Authored By
dungodung
Aug 23 2005, 2:15 PM
Referenced Files
F32368585: image.png
Sep 30 2020, 8:34 AM
Tokens
"Love" token, awarded by Prototyperspective."Like" token, awarded by Liuxinyu970226."Like" token, awarded by Quiddity."Grey Medal" token, awarded by Dalba."Like" token, awarded by Fauzan."Like" token, awarded by Kozuch."Love" token, awarded by DiegoQueiroz."Love" token, awarded by He7d3r.

Description

Since Redirects are shown in a different fashion in the "What links here" pages,
I think it would be good to show the template relations in the same manner.

For instance, there is a template {{foo}} and pages [[bar]], [[baz]] and [[bat]]
contain the template. Now, the template itself contains a link to, say,
[[quux]]. Therefore, the three aforementioned articles (ba*) contain the link
[[quux]]. In the "What links here" page for [[quux]], the result should be
treelike, resembling redirects:

The following pages link to here:
View (previous 50) (next 50) (20 | 50 | 100 | 250 | 500).
*[[quuxx]] (redirect page)
[[Xyzzy]]
*[[Template:foo]] (template page)
[[bar]]
[[baz]]
[[bat]]
*[[shme]]

See Also:
T3392: "What links here" should show only the template linking, not all pages containing the template. Same for "pages that use this image".
T14396: "what links here" should list the template, not the pages that use it

Details

Reference
bz3241

Event Timeline

bzimport raised the priority of this task from to Low.Nov 21 2014, 8:46 PM
bzimport set Reference to bz3241.
bzimport added a subscriber: Unknown Object (MLST).

iano wrote:

I agree. Any solution which eliminates or distinguishes links brought in by Templates would be helpful.

My use case is determining which of several articles to be merged is most popular. Links brought in by
templates can swamp the results. Example: pages [[Production battery electric vehicle]] and [[List of
production battery electric vehicles]], one of which includes [[Template:Energy related development]]
which completely swamps the "what links here" results with its hundred links.

rasamassen wrote:

Another option would be to have a link to Show/Hide Direct and Indirect transclusions.

apoc2400 wrote:

More simple would be to have a way to hide all links that are not simple links in the actual wikitext of the articles. That would also hide links from templates such as {{cite news|...|authourlink=John Smith}}, but I think that is acceptable. All those navigation boxes are really swamping "What links here", at least on English Wikipedia.

hpvpp wrote:

Would it be possible to make the filter be sensitive to the status of the "show/hide" button on a template, i.e. show the links from a transcluded template only when the template is actually shown and hide those links otherwise?

Right now transclusions are extracted as the parser parses the page. In other words, even though a template may be excluded by another template, because we are calculating these in this way there's no real difference between a template that was directly transcluded and one which was transcluded by another template (and of course what templates another template transcludes can differ based on what page they are transcluded into and if they are transcluded).

The first step here, would probably be to make use of the preprocessor $frame to try and differentiate between direct and indirect transclusions when building the parser output. There is a slight chance we might be able to export a bit more of the tree of information from that I suppose.

..then we can argue what the best ui for exposing that information is.

Aside from it not being possible with the current system, there's also the matter of deciding what is made by what.

A link in a template would be deeper in the tree than the template itself. However what about stuff like this:

[[Article]]

{{Sometemplate

param=Foobar

}}

[[Template:Sometemplate]]

Check out [[{{param}}]]

Etc. you can imagine the possiblities and dependencies. It's hard and depends on point of view to say that a link is "from a template" as there are dynamic dependencies both up and down the tree that may change things.

I'm thinking a WONTFIX...

hpvpp wrote:

Not being able to filter out links originating from templates makes the "what links here" useless for pages containing such templates. If the functionality was created to assist editors (which I think is safe to assume) then it clearly was not thought through properly before being implemented. And if that is indeed the case then a WONTFIX would be a blatant disregard of responsibility.

At [[Wikipedia:Village pump (technical)/Archive 69#What links here and navboxes]] I suggested a relatively simple sounding version: An option to hide pages that would not have linked if no transclusions had been performed on them. This seems good enough for most purposes to me, and a big improvement over the current options.

(In reply to comment #9)

At [[Wikipedia:Village pump (technical)/Archive 69#What links here and
navboxes]] I suggested a relatively simple sounding version: An option to hide
pages that would not have linked if no transclusions had been performed on
them. This seems good enough for most purposes to me, and a big improvement
over the current options.

That means links made by the article but through transclusion won't be shown.
eg. links by {{user2}} or {{Infobox}}. (although that could be an acceptable loss)

But aside from that illogical and inconsistant behaviour that will undoubltly occur, I don't think it's technically possible.

If Article A has a template call to {{Foo}}.
{{Foo}} contains a link to Article B.

Then on Article B will be WhatLinksHere:

  • Article A
  • Template:Foo

This can't be avoided in any way since when the page is saved the entire parsing of it is put into the pagelinks table, when getting WhatLInksHere one can't filter out indirect links.

but although incoming links can't be distinguished, outgoing links can. So in the futuristic "What leaves here" (bug 26757) there could be an option (if really needed) to "Hide/Show indirect links" (page-, template- and filelinks). Correct me if I'm wrong, but for incoming links this is next to possible unless a really big change is made in the database schema.

On an aside, I think Special:Search is sufficiently powerful at this time to take care of curating "manual" links--reference this search using linksto and insource to isolate links to the article on Issik Qaghan.

debt subscribed.

We won't be able to get to this any time soon, based on our quarterly and annual goals; moving to later on our board.

Just a heads-up that there is an extension that kind of solves this issue – AdvancedBacklinks. It is however a bit messy and requires two custom hooks in the parser that will never be merged into core (see T232305). It also means that it won't simply port to Parsoid (though I'll later investigate whether that can be done).

image.png (923×1 px, 99 KB)

Aklapper changed the subtype of this task from "Task" to "Feature Request".Feb 4 2022, 11:02 AM
Aklapper removed a subscriber: wikibugs-l-list.