Open main menu

Changes

→‎Number of links: update links to Dispenser tool
{{pp-protected|reason=Disruption|small=yes}}
{{Information page|WP:WLH}}{{Linking and page manipulation|linking and diffs}}

Within the Toolbox section on the left-hand side of every page is a link labeled "'''What links here'''". This is used to see a list of the pages that [[Help:Link|link]] to (or [[WP:Redirect|redirect]] to, or [[WP:Transclusion|transclude]]) the current page. These are sometimes referred to as '''[[backlink]]s'''.

It is possible to make a wikilink to the "What links here" list for a particular page; to do this type <tt><nowiki>[[Special:WhatLinksHere/</nowiki>''Page&nbsp;name'']]</tt>, replacing ''Page name'' with the title of the target page. (The same text – without the brackets – can also be entered in the search box, to access "What links here" for any page title.)

It is also possible to list the pages with <tt><nowiki>{{Special:Whatlinkshere/</nowiki>''Page&nbsp;name''|namespace=''number''<nowiki>}}</nowiki></tt>, where ''Page name'' is the name of the page, and <code>namespace</code> (optional) is [[help:namespace|the number of the namespace]]. E.g. <tt><nowiki>{{Special:Whatlinkshere/Help:What links here|namespace=0}}</nowiki></tt> lists all pages from article space that link to this page.

To use the tool, click '''[[Special:WhatLinksHere]]''' and type in the page title.

"What links here" is limited to showing actual backlinks. Pages which contain the title being searched for, but where the title has not been linked, are excluded from the results. An [[User:Lourdes/Backlinks|alternative script]] exists to search out such pages, where possible unlinked backlinks may exist for the respective article.

==Overview==
The "What links here" facility lists the pages on the same site (English Wikipedia) which link to (or [[WP:Redirect|redirect]] to, or [[WP:Transclusion|transclude]]) a given page. It is possible to limit the search to pages in a specified [[WP:Namespace|namespace]]. To see this information, click the "What links here" link while looking at any page. The list is sorted by page ID, i.e., by date of creation of the page.

This information comes from the [[mw:pagelinks table|pagelinks table]] and the [[mw:templatelinks table|templatelinks table]]. Pages redirected to the given page are marked "redirect". Pages transcluding the given page are marked "transclusion"; for these pages it is not shown whether they also ''link'' to the given page. For image and other file pages, the pages using the image or file appear on the list and are marked "image link".

The parser function [[:mw:Help:Extension:ParserFunctions##ifexist|#ifexist:]] causes a listing in "What links here" among the normal links even though no link is produced.

The list of links to an article is useful in a number of ways:
* The number of incoming links gives a rough indication of how important or popular a page is.
* Where the intended subject material of an article is unclear, the list of articles linking to it might provide useful context.
* It facilitates proper [[Wikipedia:Disambiguation|disambiguation]].

The function works even for a page title that does not exist (recording [[WP:Redlink|redlinks]] to that title). The "What links here" link appears on the edit page on which one arrives when following a broken link. Thus, for example, if film articles are linked to the actors, one can find the films an actor has played in even if there is no article about the actor.

To invoke a "What links here" list directly (in the search box, browser address bar, or wikilinks) use the syntax [[Special:WhatLinksHere/John Smith]] (replacing "John Smith" with the desired target article title).

==Limitations==
The following are ''not'' listed at "What links here":
*automatically generated links from [[Help:Category|categories]] to their subcategories and member pages (and vice versa)
*automatically generated links from [[Help:Subpage|subpages]] to their parent pages
*links in [[Help:Edit summary|edit summaries]]
*links in [[Help:Special page|special pages]], for example [[Special:LongPages]]
*links made with [[Help:Link#External links|external link]] syntax instead of wikilinks, for example https://en.wikipedia.org/wiki/Example instead of the wikilink [[Example]] made with <code><nowiki>[[Example]]</nowiki></code>
*links from outside Wikipedia

In the case of links to [[Help:Section|sections]] or other anchors, the precise target is not shown. "What links here" cannot list the backlinks of a specific section/anchor only. (It may be possible to work round this by making a new title that redirects to a particular section, and encouraging people to make links to the redirect rather than the section. Another possibility is to use [[Help:Linksearch|Linksearch]], but here users would have to add hidden external links.)

As mentioned, backlinks which have not yet been linked are excluded from the results. An [[User:Lourdes/Backlinks|alternative script]] exists to search out such pages.

Also note that if a page's links change because of a change in a [[Help:Template|template]], the backlinks for that page are [[mw:Manual:Job queue#Updating links tables when a template changes|not updated immediately]], but via the job queue.

==Redirects==

The What links here report will list a [[Help:Redirect|redirect]] to a page, and indented under it any incoming links to the page that go through that redirect.

For a double redirect, the indent is double, and any incoming wikilinks to the page that go through the two intervening redirects are then shown triple indented. Although they are shown, double redirects are cleaned up; any triple redirects will become doubles, so triple redirects are not shown, just doubles.

The "Show redirects only" link is missing from What links here as of June 1, 2018 due to [[phab:T189860]]. Work to restore it is ongoing.
Available from every ''What links here'' report <s>is</s>was
'''<span class=plainlinks>[https://tools.wmflabs.org/dispenser/cgi-bin/rdcheck.py?page=Help:What_links_here Show redirects only]</span>''', an external tool.
The external report differs from the
"hide links" (wikilinks) "hide transclusions" procedure.
The external tool shows the same report for any and all redirects,
whereas the internal report is different for every redirect page.
This makes the external tool ''name agnostic'', and ''content oriented''.
Also the external tool reports what links to a section (but only redirects).
Again, this is ''content oriented'', so '''Show redirects only''',
even for a redirect to a section, will still report on all the others.

For a demonstration, see the [[Special:WhatLinksHere/Help:What_links_here|What links here]] report for this page.
Double redirects and redirects to sections are set up at [[/demo rdcheck]].

==Transclusions==
The backlinks list includes [[WP:Transclusion|transclusions]] of the current page.

It also includes links which exist on certain pages because the page transcludes another page (template). For example, if page A transcludes template B, and B contains a link to C (not contained within <nowiki><</nowiki>noinclude> tags), then the link to C will appear on page A, and A will be listed among the backlinks of C.

It is possible that a page contains a link to C because it transcludes a template even though the template does not itself contain such a link (the link may be produced in the template wikitext by the application of various [[Help:Parser function|parser functions]], rather than explicitly). In this case the template will not show up in the backlinks of C, although pages on which it is transcluded will (if they have the links to C). It may be convenient to make the template appear on the list by placing a link to C on the template, within <nowiki><</nowiki>noinclude> tags.

==Number of links==
The "What links here" page does not display how many backlinks exist in total. The number of links displayed at one time is limited – initially to 50, although there are links to change this to certain other values. (Different values can be obtained by editing the URL resulting from clicking these links, but the maximum possible value is 5,000.)

[[User:Dispenser]] maintains a tool that returns the total number of backlinks to a page: use the following URL:
*<tt><nowiki>https://dispenser.info.tm/~dispenser/cgi-bin/backlinkscount.py?title=</nowiki>''Page_name''</tt>

For extended syntax see the [https://dispenser.info.tm/~dispenser/cgi-bin/backlinkscount.py tool documentation page].

==Extensions and programming==
=== Number of Backlinks ===
The "What links here" page body has selector body.page-Special_Whatlinkshere, so for example we can use the [[Help:Cascading Style Sheets|CSS]] <tt>body.page-Special_Whatlinkshere ul { list-style: decimal }</tt> to number the backlinks.

It is possible to obtain the list of backlinks (with additional information) programmatically using the MediaWiki API. For information on how to do this, see the [[mw:API:Backlinks|API documentation]].

=== Semantic Relations ===

With the extension [[Semantic MediaWiki]] (SMW) links are categorized by specifying relations. For a given relation the backlinks of a page can be produced in-page. A series of queries, one for each relation (which seems cumbersome but can be put in a template like [http://semanticweb.org/wiki/Template:Ask]), provides an in-page list of backlinks sorted by relation. Moreover, forward links and attributes of the resulting pages can also be provided, and also backlinks of backlinks.

=== DPL method ===

A simpler extension that can embed backlinks (without the semantic functionality) is [[mw:Dynamic Page List|Dynamic Page List]]. '''EXAMPLE NEEDED'''

=== Suppress links ===

"(← links | edit)" can be suppressed by placing the following in Common.css
<pre>.mw-whatlinkshere-tools{
display:none;
}</pre>

'''However, "(transclusion)" can't be suppressed with that CSS. Maybe with CSS# positional-selection.'''

=== Unclear Warning ===

It is ''not'' possible to simply transclude a "Special:WhatLinksHere/''Page_name''" page, as only a certain sub-group of Special Pages can be transcluded: [[Wikipedia:Transclusion#Special pages]].

== Examples ==
*[[Special:WhatLinksHere/James Fowler]]
*[[Special:WhatLinksHere/Help:What links here]]
*[[Special:WhatLinksHere/Gradient Descent]]

==See also==
*[[User:Lourdes/Backlinks|Script to search out all unlinked backlinks]]
*[[Help:Category#"Related Changes" with categories|"Related Changes" with categories]]
*[[Wikipedia:Database reports/Templates transcluded on the most pages|Templates transcluded on the most pages]]
*[https://tools.wmflabs.org/templatecount/ Template transclusion count] for templates and modules
*[https://github.com/greencardamom/Backlinks-Watchlist Backlinks Watchlist], a unix tool for monitoring changes to a page's backlinks.
*[https://github.com/greencardamom/Wikiget Wikiget], a unix tool to retrieve the full list of backlinks for page.

{{Wikipedia technical help|collapsed}}
[[Category:Wikipedia link help|What Links Here]]
[[Category:Wikipedia sidebar help|What Links Here]]
[[Category:Wikipedia interface help|What Links Here]]
Anonymous user