Page MenuHomePhabricator

"what links here" should list the template, not the pages that use it
Open, LowPublic

Description

Author: DanClemmensen

Description:
When a template directly introduces a link to a target page, the "what links here" list for the target page should list the template as a link to the target, but it should not list a page that uses the template as links to the target (unless the using page also has direct links to the target.)

Alternative: Treat links generated by a template similarly to links via a redirect: that is, list the template, and then list all pages linked via the template indented under the template link.

Justification: "what links here" is used by people who move a page to find and repair all of the links to the page. We also use "what links here" to gauge the relative importance of several pages when determining whether a particular page should retain the "main title" when disambiguation is needed. A third major use of the "what links here" is to generate the list of "most needed articles." In all three cases, the resultes rae severely distorted when th epage is linked from a template. For example, a completely obscure Football coach named Clyde Snerd suddenly has 50 links when he is one of 50 football coaches listed in a template of "coaches of the Lower Smedley football club." If I move his page to "Clyde Snerd (football coach)" I must then check all 50 pages to see if any of them have non-template references.Changiong e template first does not help, because the resulting updatea process (apparently) runs in the background and can take quite a long time. The result on the "most wanted articles" list is dramatic: all of the topmost "most wanted" articles are due to inclusions in templates.


See Also:


Proposed in Community-Wishlist-Survey-2016. Received 37 support votes, and ranked 41 out of 265 proposals. View full proposal with discussion and votes here.

Details

Reference
bz12396

Event Timeline

bzimport raised the priority of this task from to Low.Nov 21 2014, 10:00 PM
bzimport set Reference to bz12396.
bzimport added a subscriber: Unknown Object (MLST).
bzimport created this task.Dec 24 2007, 5:03 AM

mike.lifeguard+bugs wrote:

I don't think this is possible with the current schema which tracks links between pages. Furthermore, I don't see the utility in changing things.

IAlex added a comment.Oct 24 2009, 5:02 PM
  • Bug 21266 has been marked as a duplicate of this bug. ***

hardy wrote:

Oh, great. The fact that there is one person somewhere who FAILS to see the utility is now considered a cogent point.

When I move an article and then click on "what links here", I sometimes see a
couple of hundred links nearly all of which result from pages using a template.
After editing the template to link to the new title, I want to see the
(usually few) links from articles themselves, rather than those resulting from
a template. Currently the only way to do this is to wait 24 hours so that when
you view "what links here", the template links will no longer link to the old
title. Currently one can click on "hide redirects"; there should be a similar
thing to hide links resulting from articles' use of templates.

I reported the above as a bug, and it got marked as a duplicate of this even though it proposes something DIFFERENT.

IAlex added a comment.Oct 24 2009, 5:20 PM

It's a bit different, but the problem is the same: currently templates are expanded and only after that links are parsed and replaced. To fix this, we should change parsing older to parse links in the same time as we expand templates and change the pagelinks database table to know if the link is directly inserted in the page or comes through a template. Also a problem would be parameter substitution: {{Some template|link=[[Some page]]}} or {{Link|page=Some page}} where Template:Link contains something like "[[{{{page}}}]]", for those two cases, should the link be considered as comming from the page, or the template? (first example might be easier than the second one)

IAlex added a comment.Oct 24 2009, 5:21 PM

sorry: order, not older.

  • Bug 28855 has been marked as a duplicate of this bug. ***

ekonomiska wrote:

I posted that duplicate bug, and I agree that it's the same problem as already given here.

I don't know which of the proposed solutions should be used to fix this bug, but it desperately needs to be fixed.

rd232 wrote:

@Alexandre Emsenhuber:


Also a problem wouldbe parameter substitution: {{Some template|link=[[Some page]]}} or {{Link|page=Some page}} where Template:Link contains something like
"[[{{{page}}}]]", for those two cases, should the link be considered as comming
from the page, or the template? (first example might be easier than the second

one)

Those cases should clearly be considered as coming from the page calling Template:Link, since "some page" is linking data stored in the calling page, not the template.

(In reply to comment #8)

@Alexandre Emsenhuber:

Also a problem wouldbe parameter substitution: {{Some template|link=[[Some
page]]}} or {{Link|page=Some page}} where Template:Link contains something like
"[[{{{page}}}]]", for those two cases, should the link be considered as comming
from the page, or the template? (first example might be easier than the second

one)

Those cases should clearly be considered as coming from the page calling
Template:Link, since "some page" is linking data stored in the calling page,
not the template.

Yeah, that's easy to say for a human. But a piece of software is likely not going to able to distiguish that.

for example:

Template:Foo contains:

This is a [[department]] [[portal]].

{{#ifeq: {{{type|normal}}} | special | Welcome to the [[special]]
department. | Welcome to the department page of the [[normal people]].}}

Department:Special contains:

{{Foo|type=special}}
Blablablabla.
[[Category:Departments|Special]]

Does the link to [[special]] come from the template or from the article ?
The answer to this doesn't matter and likely not obvious, but untill the parser has been rewritten and world piece has been made I dont think such advanced extractions can be made from a simple page with templates.

That doesn't mean we can't do any extractions at all. A simple way to approach this bug's goal would be to compare links generated from {{Foo}} to whatever the template call was (eg. {{Foo}}), and whatever was added consider that caused by the article, and the rest to be coming from the template and thus further down the tree on WhatLinksHere.

(things to keep in mind though are constructions with <includeonly> and the like, and comparisons to {{PAGENAME}} etc.)

rd232 wrote:

@Krinkle

I'm not sure it has to be that complicated. Any time a template wraps a parameter in [[ ]], it's link data the calling page is responsible for. Otherwise, it's link data stored in the template. Though comparing links from the template and the template call, as you suggest, may be helpful.

I'm sure there are hard cases which may be generated what might be considered categorisation errors, but this system doesn't have to be perfect in correctly including/excluding templates, as long it categorises links one way or the other. (I'm imagining there would be a switch so you could choose to look at page links, templates links, or both together.)

  • Bug 17728 has been marked as a duplicate of this bug. ***
  • Bug 21266 has been marked as a duplicate of this bug. ***

Sounds like bug 1392

Qgil added a comment.Jul 12 2013, 1:23 PM

Or like Bug 3241 - Transclusion should produce tree-like results in "What links here"

LMLB added a subscriber: LMLB.Feb 1 2017, 3:03 PM
This task was proposed in the Community-Wishlist-Survey-2016 and in its current state needs owner. Wikimedia is participating in Google Summer of Code 2017 and Outreachy Round 14. To the subscribers -- would this task or a portion of it be a good fit for either of these programs? If so, would you be willing to help mentor this project? Remember, each outreach project requires a minimum of one primary mentor, and co-mentor.
Izno added a subscriber: Izno.May 8 2017, 11:56 PM

I made this comment at T5241#3246126, because I'm not entirely sure which is the interesting ticket: 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 added a subscriber: debt.

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.

I think this will require digging into the parser. What is stored in mysql, and elasticsearch, is based on what the wikitext parser says was used in the page. Currently the wikitext parser says that page was linked so that's what gets stored in mysql and indexed into elasticsearch.

Quiddity updated the task description. (Show Details)Jun 14 2017, 5:13 AM
Qgil removed a subscriber: Qgil.Jun 14 2017, 6:51 AM

In some cases it could be desirable to link back, so if this is going to be implemented it should be in a manner that is editor controlled as to the link back target.

Krinkle removed a subscriber: Krinkle.Jan 25 2019, 1:39 AM
Danbloch removed a subscriber: Danbloch.
Danbloch added a subscriber: Danbloch.
Restricted Application removed a subscriber: Liuxinyu970226. · View Herald TranscriptMar 8 2019, 5:48 PM
Ammarpad reopened this task as Open.Mar 8 2019, 5:49 PM
Ammarpad added a subscriber: Ammarpad.

Oops, I wanted to merge the newer one here T217906.