A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://www.mediawiki.org/wiki/Manual:Checking_for_page_existence below:

Manual:Checking for page existence - MediaWiki

There are several methods to check if a page exists. The table below describes this. But first, here is what each column in the table means:

Method What links here Transclusion Limitation Usage Interwiki link[1] Pagename with anchor Page existed only in another language variant #ifexist yes before 1.45, no after no[2] Expensive (max 100 by default or 500 on Wikimedia wikis) branching "doesn't exist" checks page existence correctly, but not the existence of the anchor "exists" Using #ifeq to compare a transclusion and a link[3]. yes yes Transclusion counts against the post-expand include size limit (2048KiB by default) branching "exists" "exists" "exists" {{PROTECTIONEXPIRY}}[4] no no none branching doesn't exist doesn't exist doesn't exist title::exists (requires Extension:Scribunto) yes before 1.45, no after no Expensive (but one page only count once in single invocation) branching "doesn't exist" checks page existence correctly, but not the existence of the anchor "doesn't exist" linking: class="new" means non-existence yes no none seeing the page link in a style depending on existence class="extiw" checks page existence correctly, but not the existence of the anchor "exists" Special:Allpages no no none seeing the page listed or not not listed n.a. not listed Special:PrefixIndex no no none seeing the page listed or not not listed n.a. not listed (PrefixIndex is variant sensitive)

Examples:

{{Special:PrefixIndex/exist}} gives:

Another approach involves visiting the specified web address and checking either the content or receiving a message indicating that the page does not exist.

Branching applications[edit]

An example of existence detection in practical use is:

A special case is:

If there are only a few possible pages, another option is to create them all, with extra pages using default values, and transclude them wherever necessary.

  1. Interwiki links apply with the correct prefix, regardless of whether the linked page exists.
  2. In an #ifexist parser function condition, if the page is specified with the transclusion syntax, it counts regardless of whether the page exists. However, if the page name is used directly in the condition and another page is specified in the alternative part, only actual transclusions are considered valid.
  3. See Manual:Checking for page existence/ifeq method for more details on how this works
  4. See Manual:Checking for page existence/PROTECTIONEXPIRY method for more details on how this works

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4