Jump to content

Community Wishlist Survey 2017/Miscellaneous/Stop ifexist checks from appearing in Special:WhatLinksHere

From Meta, a Wikimedia project coordination wiki

Stop ifexist checks from appearing in Special:WhatLinksHere

  • Problem:

#ifexist is a very useful tool - it lets you check if a page exists in template logic. However, doing the check also makes a link appear in Special:WhatLinksHere for the page whose existence was checked - and that causes problems for Wikimedians who are checking links to disambiguation pages, as there's no way to stop the link from appearing. This is part of a wider issue, as doing the same check in Lua also causes this problem.

  • Who would benefit:

People writing template code who want to use #ifexist to provide extra functionality, but can't. People doing disambiguation checking while people are using #ifexist statements.

  • Proposed solution:

Either stop #ifexist from creating a link in Special:WhatLinksHere, or create a new magic word that does the same as #ifexist without creating the link.

  • More comments:

This is a long-running problem: phabricator:T14019 was filed in 2007! It was also included in the 2015 Community Wishlist. I came across this more recently, when trying to use #ifexist to check for location redirects in Wikidata infoboxes, which caused problems e.g. see en:Wikipedia:Village_pump_(technical)/Archive_158#Wikidata_problem and is having to be manually worked around. It also caused problems at en:Template_talk:Infobox_journal#Links_to_DAB_pages with redirects to journal titles.

  • Phabricator tickets:




What's the use case that causes an ifexist check for a disambiguation page? How widespread is this issue? Max Semenik (talk) 21:40, 18 November 2017 (UTC)[reply]

@MaxSem: See the links I posted above. As an example of the case that introduced me to this issue, see en:Telescope Array Project - in the infobox, the desired wikilink for the location is to en:Millard County, Utah, however from Wikidata all I can fetch is en:Millard County, en:Utah (or the same text without wikilinks) - I can then find the desired link by checking {{#ifexist:Millard County, Utah}} and I can then use that link - however that exact same code used at en:Great Melbourne Telescope will be {{#ifexist:Victoria}}, which finds a link to en:Victoria, which is a disambiguation page. This then causes the problem described at [1]. This issue is a fundamental one that means that we can't use ifexist like this, which is a real shame. And, again, this was first reported way back in 2007 in other situations! Thanks. Mike Peel (talk) 21:58, 18 November 2017 (UTC)[reply]
In this particular case, it sounds like you should use the interwiki link from WD instead of trying to construct the county name by hand. Max Semenik (talk) 22:47, 18 November 2017 (UTC)[reply]
@MaxSem: @Nikkimaria objects to using "Millard County, Utah" rather than "Millard County, Utah" per en:WP:MOS, so I'll let them argue the case for that here. But regardless of that, #ifexist should be something that is *usable* by template developers rather than something that causes unnecessary problems. Thanks. Mike Peel (talk) 23:02, 18 November 2017 (UTC)[reply]
Probably the best way to solve that would be for the system to get the wikilink of the claim instead of ifexist (i.e. propertyX.wikipedia.en."Millard County, Utah" or whatever in Lua). Both are expensive functions anyway, so it's not like you would be trading performance. --Izno (talk) 04:38, 19 November 2017 (UTC)[reply]
I wouldn't narrow this just to disambiguation pages. I know about many usages where {{#ifexist:}} has been used for purpose of intentional not linking the non-existent pages, but linking if they exist (in other words blue link or plain text (instead of red link)). This is typically used in two cases: 1) when the page has been deleted and you don't want it to be re-created, 2) you have different mechanism to link to non-existent page, typically something like {{#ifexist:Page|[[Page]]|[{{fullurl:Page|action=edit&editintro=info&preload=template}} Create the Page]}} (mind that non-existent pages linked via the latter construction are not part of Special:WantedPages).
Danny B. 23:21, 18 November 2017 (UTC)[reply]

This problem is widespread in ruwiki where there are modules/templates that automatically check the existense of various pages (and link there if they exist). Instruments for checking unexistent linked pages (e.g. Special:WantedPages, tools that update wikiproject pages, like this one, relying on red links) fail when they come across pages that are checked by #ifexist (user complaints, in Russian). Jack who built the house (talk) 08:31, 19 November 2017 (UTC)[reply]

Maybe do not simply filter those ifexist links out of the result, but allow to filter them in or out. → «« Man77 »» [de] 14:11, 2 December 2017 (UTC)[reply]

@Tim.landscheidt, Thomas Obermair 4, Dominic Z., Ninovolador, Galobtter, L3X1, LikeLifer, Joalpe, Metrónomo, MBH, 91i79, Kaganer, Vort, Iliev, Facenapalm, and NickK: If you're still interested in this issue, please see Community Wishlist Survey 2022/Miscellaneous/Check if a page exists without populating WhatLinksHere. (Only pinging those that didn't vote for this in 2019 and 2021 to cut down on pings.) Thanks. Mike Peel (talk) 19:34, 28 January 2022 (UTC)[reply]



It should be also noted, that Scribunto functions of title library which work with non-existent pages, also produce a record on Special:WantedPages. So preferably the behavior should be consistent in both cases of Scribunto and wikitext.
Danny B. 23:28, 18 November 2017 (UTC)[reply]

Scribunto doesn't do anything differently. I suspect you're mistaken about #ifexists not showing on Special:WantedPages. Anomie (talk) 00:42, 20 November 2017 (UTC)[reply]
I just checked it. #ifexists does indeed result in an entry on Special:WantedPages. Anomie (talk) 15:52, 11 December 2017 (UTC)[reply]

Why this happens


MediaWiki needs some way to know which pages need to be updated when a page is created or deleted. Usually this is because of a wikilink, so it can be turned from red to blue or vice versa, but it has to happen for things like #ifexist too. If someone were to implement this request, it would require either a new field to record the "kind" of link or a whole new table. Anomie (talk) 00:42, 20 November 2017 (UTC)[reply]