Wikilinks (internal links)
A wikilink (or internal link) is a link from one page to another page within the English Wikipedia, or, more generally, within the same Wikipedia (e.g. within the French Wikipedia), in other words: within the same domain, or, even more generally, within the same Wikimedia project (e.g. within Wiktionary). Links are enclosed in doubled square brackets: *Inserting and deleting internal links
* When editing ''source'', links are inserted or deleted simply by adding or removing pairs of square brackets enclosing the text concerned (plus handling piped links). There are some helpful tools: * When using theInterwiki links
An interwiki link links to a page on another Wikimedia project website, such as Meta or another language Wikipedia. The target site must be on the interwiki map specified for the source wiki. These links have the same m:Help:Link
links to the "Help:Link" page on Meta, while :commons:Athens
links to page "Athens" on Wikimedia Commons as: :commons:Athens.
Interwiki links can be piped, just as with wikilinks. Remember that an interlanguage link should be preceded by a colon if it is to be displayed, where it is inserted in the text, as an inline interlanguage link; otherwise it will be displayed in the list of interlanguage links at the side of the page (which is appropriate only if it is the most closely corresponding page in the other language Wikipedia). Thus (incorporating the pipe trick),
would be used to link to Wikilink on Japanese Wikipedia. Example: (
links to URL on Japanese Wikipedia).
Interwiki links (like external links) are displayed in a slightly paler blue than ordinary wikilinks. The External links
External links use URLs to link directly to any web page. External links are enclosed in single square brackets (rather than double brackets as with internal links), with the optional link text separated from the URL by a space (not a ", " as with internal links). When rendered, external links are followed by an external link icon. For example, ::http: and https:
http://en.wikipedia.org/wiki/Help:Link
will result in the webserver redirecting you to https
should be specified to avoid the needless redirect, as in https://en.wikipedia.org/w/index.php?title=Help:Link&action=history
.
In the past, when Wikipedia could be accessed via either HTTP or HTTPS, a protocol-relative URL could be used to make an external link (or external-style link to an internal page) which would use http:
or https:
depending on how the page the link appeared on was accessed, as in http:
or https:
should be explicitly specified as appropriate for the target site (preferring https:
, where available).
What is an "anchor"?
The word "anchor" has two opposite meanings. In the context of a link from an ''anchor'' to a ''target'', it is the starting place. In the context of the template, an "anchor" is a landing place for a link to jump to. The anchor ''template'' automatically creates some invisible coding from ''certain text in the template'' in the "landing place". In this context, the word "anchor" may refer to: * the text and parameters, in the template, from which the invisible code is created, * the mostly invisible HTML code, or * the landing place/location/spot in itself.Section linking (anchors)
To link to a section or subsection in another page, append a#
and the section name to the page name:
:
For linking in the same page, omit the page name and use a #
and the section name:
:
Omitting the page name is recommended when linking to a section in the same page because the link will work as expected when previewing changes or after moving the page.
To format a link with the section sign (§) instead of a # (e.g. rather than Page name#Section name), use the template (alias ):
:
Note that section names are entirely case sensitive, in contrast to article links, where the first letter is not case sensitive.
The characters
require encoding when linking to a section:
For example, the section " losedComplaint" can be linked with #.5BClosed.5D Complaint
. Links in the table of contents will automatically make this encoding, so the URL can be copied from there. However, that URL will also encode other characters which do not interfere with templates or wikicode, so the result may look ugly.
For more information, see Help:Section. See also .
Specifics
When a link contains a section title (as in the examples above), the title actually points to an HTML ''#
syntax.
Section links still work through page names that are redirects. For example, if Danzig redirects to Duplicate section names
If more than one section on a destination page has the same title, a link to the title is to the first section with that title. If the link should be to another section with the title or a title that differs only in capitalization (Example vs. EXAMPLE), append to the linked title _2, _3, and so on, without a space (or 2, 3, and so on ''with'' a space), counting from the top of the destination page and without regard to whether a section is a section or a subsection. For example, multiple sections titled "History" may be linked to as "History", "History_2" (or "History 2"), and so on.Linking to part of a section
Anchors can also be used to link to any part of a section. For example, if you want to link to the fifth sentence of a section, you place an anchor at the start of that sentence, and you can then link to that anchor in the same way as you would link to any other anchor. However, just as with section names, duplicate anchor names only link to the first one. Since anchors aren't displayed you have a much greater freedom in picking unique anchors, such as by appending the current date and time to the anchor name (for example, by naming an anchor for section "ThisSection" like so:Table row linking
To create an anchor for a row of a table, see . However, #top
and #toc
are reserved names that link to the top of a page and the table of contents, respectively.
Piped link
A piped link is an internal link or interwiki link where the link target and link label are both specified. This is needed in the case that they are not equal, while also the link label is not equal to the link target with the last word extended: *cheese
Cheese is a type of dairy product produced in a range of flavors, textures, and forms by coagulation of the milk protein casein. It comprises proteins and fat from milk (usually the milk of cows, buffalo, goats or sheep). During prod ...
''(label = target, no pipe needed)''
*: produces cheese
Cheese is a type of dairy product produced in a range of flavors, textures, and forms by coagulation of the milk protein casein. It comprises proteins and fat from milk (usually the milk of cows, buffalo, goats or sheep). During prod ...
s
''(label = target + extension s" no pipe needed)''
*: produces cheese
Cheese is a type of dairy product produced in a range of flavors, textures, and forms by coagulation of the milk protein casein. It comprises proteins and fat from milk (usually the milk of cows, buffalo, goats or sheep). During prod ...
''(label = part of target, pipe required)''
*: produces blue cheese
''(label = target + additional text blue" pipe required)''
*: produces blue cheese, linked to the article Cheese.
* that stuff
''(label is completely different from target, pipe required)''
*: produces that stuff, linked to the article Cheese.
This allows linking a word or phrase within the text of a page rather than using "see also", even if the wording does not exactly correspond with the name of the target page. With a suitable browser and depending on the preferences set, one can still see the link target: when you point at the link, the name shows up in a hover tooltip and is also shown in the status bar.
For instance:
station
Using a redirect as alternative
An alternative to a piped link is using redirect pages. For example, to create How to set up a coffee house, use How to set up a coffee house
and make this a redirect to coffeehouse setup. This is convenient if the redirect is already there or will also be of use elsewhere; however, there are a few drawbacks:
* The tooltip does not show the page one will arrive at.
* " Related changes" gives the changes in the ''redirect page'', not the redirect target.
Combining a piped link and a redirect, one can provide some information that is not the name of the page one links to in the hover tooltip, e.g., the pipe to a redirect UNO
will display a tooltip "United Nations Organization" when hovering over UNO, thereby explaining the abbreviation. (However, is preferred for abbreviations.)
Automatic conversion of wikitext with the pipe trick
If in a piped link the part after the ", " is left empty, it is converted to an abbreviated form of the linked page, as follows: # Any word before the first colon (:), as well as the colon itself, is removed. This word may or may not be a namespace prefix (such as "Help:") or an interwiki prefix (such as "commons:"). If the page name is preceded by a colon, "first" refers to "first after this". # If there is text in parentheses at the end it will be removed. # If there are no parentheses but there is a comma, the comma and everything after it are removed. # The link will be in whatever case is used. Just like for the three or four tildes when signing on Talk pages and the use ofsubst
, in a preview, the result already shows up in the preview itself, but the conversion in the edit box is not yet shown. Press "Show changes" to see the change in the wikitext.
;Category tag
:The sort key syntax of the category being like a piped link, the pipe trick also works for category tags, even though it is not useful there.
;Examples using colons
:
is converted to
is converted to
is converted to
is converted to
is converted to
is converted to
does ''not'' give
does ''not'' give
does ''not'' give Inverse pipe trick
On page "A (c)", B
is automatically converted to B
is automatically converted to Subpage links
A wikilink needs a ''fullpagename''nowiki />], and this is not optional except when it links to or from a Help:subpage, subpage. A wikilink to its parent page is ../, and, although no page name is given, the fullpagename is rendered. On the parent a wikilink to a subpage can use /''subpagename''nowiki />] to render a subpagename instead. Although subpages are created in article space, subpage linking does not fully function there. Subpage linking works as expected to link to any pages under a root parent page: * section linking: ../#''section'' * child-to-child subpage linking: subpagename''">wp:pgn#Subpagename_and_basepagename">subpagename''nowiki />] * parent's parent ../../ * including the ''pipe trick'' * and including help:transclusion">transclusions: and Consider that there are about 140 arranged in 97 branches, 35 of which have two subpages, and 5 of which have three subpages. Subpage links save typing. Say you're editing this closely related group of fullpagenames: :Wikipedia:Manual of Style/Accessibility/Signatures :Wikipedia:Manual of Style/Accessibility/Data tables tutorial :Wikipedia:Manual of Style/Accessibility/Data tables tutorial/Internal guidelines To see this page's array of subpage variables and markup four levels deep, see /one/two/three/four, and from there go to level two at ''one/two''. Markup nowiki />[../ addresses the ''basepagename'', except when a ''pagename'' includes a / slash character (allowed), the basepagename/subpagename variables' characters are skewed. To see all this, and how adding an extra ../ construct fixes the resulting redlink, see wp:redlink">redlink, see /sub/page/name1/sub/page/name2/subpage level 3, and from there go to ''sub/page/name2''. Note that the top of every subpage shows the breadcrumb (navigation)">navigation links to all ''parent'' subpagenames. From these you can easily gauge levels and linking constructs. For more information: * See Wikipedia:Page name#Subpagename and basepagename. * ''Create'' a subpage by using a ''Help:red link, red link''. * See m:Help:Link#Subpage feature. * See examples at m:Link/a/b and m:Help:Link/a/b.Special pages links
To create a link to a special page: Special:PrefixIndex/HMS
→ Special:PrefixIndex/HMS
Because the ampersand character (&) is disallowed, it is not possible to create an ordinary link containing &action=edit
or &redirect=no
in the URL query string. In these cases, use templates or magic words, see #Links containing URL query strings.
For example, you can use a template such as to encode a Wikimedia url link, such as one pointing to a special page with parameters.
: Changing link appearance
The ways that various links are displayed in browsers, as described above, are the default display styles in the defaultHatnote links
A hatnote is a note that sits on top of a paragraph like a hat. Such as the one below. Sometimes, an article might have a section in which it explains a concept that already has its own, dedicated article. In this case, you could add a 'Main page' link, as is done here. This can be established by using the template. In the visual editor, such a template can be created using Insert > Template > Main, and then setting the 'Page 1' parameter equal to the page to be referred to. The 'Label 1' parameter may optionally be used to set the text the link is displayed as. Up to five of these links may be specified. In the source editor, the code
can be used where page1
and label1
refer to the 'Page 1' and 'Label 1' parameters in the visual editor. Here as well, up to five of these may be present. The following hatnote templates and their texts also exist:
* : For a more comprehensive list, see
* : For broader coverage on this topic, see
* : Further information:
* : See also:
Hover tooltips
In many browsers, holding the cursor over a link ( mouseover) shows a hover tooltip containing the text of the link'stitle
attribute. MediaWiki – the software which runs Wikipedia – sets this to the target page name (without any section indication) if it's a wikilink, the page name with prefix if it's an interwiki link, and the link address ( URL) if it's an external link. (This can be switched off in the user preferences.) The browser may also show similar information, including any section indication, in the status bar.
For these effects a piped link is useful even if it is not followed; for example, for displaying the meaning of an acronym. It is possible to produce a hover tooltip without a link, using the template.
Disallowed characters
A link whose target contains disallowed characters (see WP:Page name) will be displayed without markup, as in A
.
Conversions are automatically made to non-literal characters in wiki and interwiki links. For example, Help:Page%20name
becomes Help:Page name
. However, the opposite is true for external links; literal characters are converted into non-literal characters. For example, most browsers convert .../wiki/!
to .../wiki/%21
.
Some characters in a web address link need to be represented as escape characters because they are reserved for Wikipedia edits. Examples include %5B
for , %5D
for ">/code>, %5D
for
/code>, %3C
for <
, %3E
for >
, %7B
for
, %7C
for ,
, and %26
for &
. More can be found by reading about percent encoding. Numeric character references (e.g. [
or [
) should not be used in external links because the ampersand character (&) has a special meaning in a URL.
In excessive cases, an automati
percent encoder such as the one at W3 Schools
(use the second JavaScript form under "URL Encoding Functions") is probably the simplest solution. For example, pasting Help talk:Citation Style 1/Archive 41# and , contribution problems
into that form yields the wikilink Help%20talk%3ACitation%20Style%201%2FArchive%2041%23%7B%7BCite%20book%7D%7D%20and%20%7Ccontribution%20problems
, which appears as Help%20talk%3ACitation%20Style%201%2FArchive%2041%23%7B%7BCite%20book%7D%7D%20and%20%7Ccontribution%20problems, as desired.
Links containing ampersands
Because the ampersand character (&) is disallowed, it is not possible to create an ordinary link containing &action=edit
or &redirect=no
in the URL query string. These kinds of links can be helpful in user pages. Also, a redirect page can have categories and you might wish to view or edit these in a single click. There are three ways to create these links:
* You can use the template to append query parameters to a Wikipedia page URL. For example,
produces the link .
* You can use the template to encode a Wikimedia url link. For example,
yields the link .
* You can use the magic word fullurl
. For example, to append action=edit
to a URL query string you could use this page's history/nowiki>
, which renders as this page's history Note that this will render as an external link rather than as an internal link and for this reason it might not appear in what-links-here queries associated with the target page.
Link reports
The navigable links to a page are wikilinks, redirects, and external-styled wikilinks.
The tag can be placed on pages with no incoming wikilinks.
To a page
Each link to a page is a link to a ''name''. No one report shows all links to the ''content''.
The What links here tool, on every page,
will report all wikilinks and all redirects to the ''content'' of that page.
(You get the wikilinks to the redirects too.)
The search parameter linksto will find wikilinks only.
Both report (invisible) wikilinks placed by a transclusion through a .
The difference between them is that ''linksto'' reports a count of links to ''a page name'',
while ''WhatLinksHere'' reports a map of links to ''the page as content''.
To a section
The navigable links to a section of a page are wikilinks, redirects, and URL-styled wikilinks.
The difference between a redirect and a wikilink is most pronounced where a redirect targets a section,
when you cannot add your own #''section'' to it
even though it appears as nowiki/>[''page name''
.
A wikilink that links to a section ''and'' that appears as [ [''page name''#''section name''">'page_name''.html" ;"title="nowiki/>[''page name''">nowiki/>[''page name''
.
A wikilink that links to a section ''and'' that appears as [ [''page name''#''section name''
can link to that section through the canonical page name (the title on the page with the actual content)
or through the page name of any redirect to it, in which case the page name is the name of a redirect page.
To find wikilinks to a section requires two or more reports.
# Show redirects only, an external tool available from the What links here page, reports redirects to the ''content'' of a section. (No matter which page ''name'' you give it, you get all the redirect page names.) Look past any "''No anchor or section''" group of redirects, and any "invalid" sections, to see if your particular section name is explicitly listed, because then the redirect pages under it can have incoming links that will then go to that section. ("What Links Here" also has a "show redirects" report, but it doesn't specify if the redirect goes to any particular section.)
# Use "What Links Here" on any redirect pages found in the previous step.
# Use to create a group of search links that will each report some links to a section. It can work with only one page name at a time. For each search link given, just change the page name in the query to each redirect in turn.
The more redirects there are, the more reports there are to run.
If there are no redirects involved, one report from "Links to" is enough.
From a page
To report links ''from'' a page, you simply list all the wikilinks on that page.
* can count wikilinks from a copy of the wikitext on your local machine.
* Some text editors support the counting and highlighting of the [...">Wikipedia:text editor support">text editors support the counting and highlighting of the [ [...
pattern occurrences.
* The Wikipedia web API accepts queries by URL.
If you will use the API heavily or professionally you should follow its currently listed recommendations at mw:API:Query">API.
(Use continue=, use formatversion2, use multiple pages at once, etc.)
One way to send a query to the API is by creating an external link ().
For example, using an external link very much like a search link, you can
send the API a request to list the link properties of " wp:example".
It should interpret it correctly as "Wikipedia:Example", ''pageid 25263910''.
; What you type
:[/ /en.wikipedia.org/w/api.php?action=query&prop=links&pllimit=500&titles=''fullpagename'' ''your label'']
; What you get when fullpagename is wp:example
: /en.wikipedia.org/w/api.php?action=query&prop=links&pllimit=500&titles=wp:example ''your label''* The report is in JSON
JSON (JavaScript Object Notation, pronounced or ) is an open standard file format and electronic data interchange, data interchange format that uses Human-readable medium and data, human-readable text to store and transmit data objects consi ...
format, as is usual for RESTful APIs.
* The pageid is available from Page information on every page.
* The titles parameter is plural. (It is designed to take multiple fullpagenames or pageid, delimited by the , pipe character.)
* The number of links returned by this query is limited to 500, per the URL you created. See mw:API:Query for how to safely get more. For example, Operating system
An operating system (OS) is system software that manages computer hardware and software resources, and provides common daemon (computing), services for computer programs.
Time-sharing operating systems scheduler (computing), schedule tasks for ...
has 510 wikilinks.
To make a page register as a link to a page, but without actually showing the link,
make a link to it, but label it with a space character using the pipe trick: [''pagename''"> .
Additional link-related functions
For the effect that links have on date formatting, see Help:Date formatting and linking.
Another link-dependent feature is Help:Related changes, related changes, which make it possible to view recent changes to all pages which are linked from the current page (or which are members of the category, if it is a category page).
For information on how to link to pages from an image, see mw:Extension:ImageMap.
Several templates have been created to make linking easier (although they are not usually used in article space). These include and for linking to templates, and and for linking to categories. More can be found in :Internal link templates.
Conversion to canonical form
As described previously, if a link target begins with a lower case letter, it will be interpreted as if it began with the equivalent capital letter. If the target contains a namespace
In computing, a namespace is a set of signs (''names'') that are used to identify and refer to objects of various kinds. A namespace ensures that all of a given set of objects have unique names so that they can be easily identified.
Namespaces ...
prefix, then the whole prefix and the first character after the colon are case-insensitive (so uSeR:jimbo Wales links to User:Jimbo Wales).
In link targets, spaces and underscores (which are effectively equivalent) are ignored if they come at the start, at the end, or immediately before or after the colon following a namespace prefix. Consecutive spaces / underscores are treated as a single space. Hence _User_: Jimbo_ __ Wales__ links to User:Jimbo Wales.
HTML character references and percent-encoded characters are replaced with their raw character. For example, département
produces département, and %40
produces %40. Links which resolve to invalid page titles are displayed as unmarked-up wikitext.
Titles indicated by wikilinks are displayed in canonical form (with correction of capitalization and excess spaces / underscores removed, as described previously) in the following places:
* In transclusion tags for non-existent pages:
gives Template:Qwsazx.
* In tooltips and in the status bar (if applicable for the browser) when the mouse cursor is moved over the link.
* On redirect pages.
* In the category box.
The prefixes in interwiki links are treated similarly to namespace prefixes: they are insensitive to case and to spaces before and after the colon. However the first character after the colon is ''not'' automatically capitalized (whether it is interpreted as a capital depends on the configuration of the target wiki).
See also
* Find link tool: a simple tool that lets you search for articles to consider adding links to.
* MediaWiki help page on links
* Help:Link color: the color of a link shows the status of the corresponding target page.
* Help:Pipe trick: uses the pipe character ("") to save typing the label of a piped link.
* Help:Permanent link: creating a permanent link to a page revision.
* Smart Linking tool: a tool for linking and previewing the linked article above the text box with the wiki code.
* Help:Self link: self links is a link to the page itself. A self-link to a page appears as bold text when the article is viewed.
* Wikipedia:Shortcut: a specialized type of redirect page that provides an abbreviated wikilink to a project page.
* Help:Colon trick: a trick when providing category, image or interwiki links.
*
* User:Tony1/Build your linking skills, a tutorial on high-quality linking with practice questions
Notes and references
{{Wikipedia technical help, collapsed