Jump to content

Help:Link

Page semi-protected
From Wikipedia, the free encyclopedia
(Redirected from H:LINK)

A video screencast showing how to create wikilinks

This page explains how to make links to pages on Wikipedia (wikilinks), to other Wikimedia projects (interwiki links), and to other websites (external links). It also explains how to make anchors within Wikipedia pages. For guidelines on how to use links, see Wikipedia:Manual of Style/Linking.

A "wikilink" is our common name for an internal link, that is, a link from one page to another page within the same Wikipedia (for example, within the French Wikipedia) or within the same Wikimedia project (for example, within Wiktionary).

Basic syntax

A wikilink is enclosed in double square brackets.

On any Wikimedia page, [[Example]] produces a wikilink with the display text Example and the target page Example on the project you're currently on. For instance, here on the English Wikipedia, the wikilink would lead to the following URL (note the "en" in the address): https://en.wikipedia.org/wiki/Example

Section linking

To link to a section in another page, append a hash mark, pound or number sign (#) followed by the section name to the page name:

[[Page name#Section name|Displayed text]]

Note the use of piping, done to hide the # character. This is appropriate in Wikipedia articles.

Alternatively, format such section links with the section sign (§) instead of a # by using the {{Section link}} template (alias {{slink}}):

{{Section link|Page name|Section name}}

Note: you cannot use the § directly.

That is, use section link or Page name § Section name rather than Page name#Section name. A third option is to use a redirect (link to a page which link directly to a section, see MOS:SECTLINK).

Outside of article space, such as in talk page discussions, using the raw # syntax is fine. Wikipedia inherits this syntax from HTML.

These section links work the same regardless of nesting, i.e. whether you link to a section header, a subsection header or a sub-subsection header (sections nestled inside other sections):

[[Page name#Subsection name|Displayed text]]
{{Section link|Page name|Subsection name}}

Note that this means that each header title must be unique across the entire page (or your browser will simply link to the first one encountered). You do not and cannot indicate "a section within a section" — [[Page name#Section name#Subsection name|Displayed text]] doesn't work as intended.

To link to a section on the page you're already on, you may omit the page name:

[[#Section name|Displayed text]]
{{Section link||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. It also makes it clear you intend a same-page link.

Note that section names are entirely case sensitive, in contrast to article links, where the first letter is not case sensitive.

The characters [ ] { } | (right and left square bracket, right and left curly braces, and the vertical bar) require encoding when linking to a section. That is, you cannot use these characters inside the [[...]] of a link. See note.[1]

For more information, see Help:Section. See also Wikipedia:Redirect § Targeted and untargeted redirects.

Alternate display text

Use a vertical bar | (the "pipe" symbol) to create a link with different display text than the name of the target page. Such a link is called a piped link. Within the link brackets [[target|text]], the part preceding the pipe gives the actual title of the link target page, and the part following the pipe gives the link display text:

[[a|b]] appears on the page as b, but, when opened, links to page a: https://en.wikipedia.org/wiki/A

Display text agglutination

Letters and other non-punctuation characters immediately following the closing bracket of a wikilink — with no whitespace in between — get appended to the link display text. The target is unchanged. This syntax provides a shorthand to link to an article by its canonical title while displaying inflected link text that grammatically agrees with the inline text:

"There are over 7,500 known cultivars of apples."

[[apple]]s gives the display text apples but the target page apple. This shorthand syntax is equivalent to [[apple|apples]].

Illustrative examples of display text agglutination
  • [[a|b]]c gives bc, equivalent to [[a|bc]].
  • a[[b]] gives ab.
    There are no special rules for text preceding a wikilink.
  • To prepend preceding text to a displayed link:
    [[b|ab]] gives ab.
  • [[a]]:b gives a:b.
    Punctuation breaks display text agglutination. This is often helpful for possessives: for example, [[Batman]]'s gives Batman's.
  • [[a]]''b'' gives ab.
    Markup notation — for example, italics delimited by two sequential single quote characters — is also considered punctuation despite not being rendered as such. As a result, italic text immediately following the wikilink is not included in the displayed link.
  • To append italicized text to a displayed link:
    [[a|a''b'']] gives ab.
  • [[a]]<nowiki />b gives ab.
    The nowiki tag turns off the rule.
  • [[a|b]]<nowiki />c gives bc.

Target page

When a wikilink is opened, Wikipedia tries to resolve the Wikilink target title to its canonical target page. See § Conversion to canonical form

When resolving the target page, the target title is treated as case-sensitive except for the first character:

  • [[atom]] links to Atom: https://en.wikipedia.org/wiki/Atom
  • [[aTom]] would link to "ATom", which does not exist: https://en.wikipedia.org/wiki/ATom

Disambiguation

When an edit is previewed before saving, if the target of a newly made link turns out to be a disambiguation page, such as the Peacemaker page, the link should be changed to one of the choices on that page unless the link is purposely in a hatnote. If necessary, the new link can be piped, such as in [[Peacemaker (character)|Peacemaker]], which appears as Peacemaker and links to the article about the fictional characters.

Readers should not be directed to disambiguation pages unless there is no other option but to do so.

Nonexistent page (red link)

If the target page of a wikilink does not exist, it is displayed in red font and is called a "red link":

This link is an example of a red link

On hover over the red link, a tool tip provides more information about the red link.

If a red link is opened, the user is taken to a blank page where it is possible to create a page using that red-linked title. While on that blank page, other red links to this (non-existent) title can be detected using the "What links here" feature.

A self link is a wikilink with a target page identical to the page on which it appears. Instead of producing an actual link, self links behave like regular body text, with no action upon interaction,[2] and are rendered as bolded body text: [[Help:Link]] is a self link to this page, so it appears on this page as Help:Link and has no action upon interaction. This is also true for piped self links: [[Help:Link|piped self links]]. However, with the preference setting "Link underlining", the bolded text is underlined; this can be suppressed by putting the following in your relevant personal CSS page:

:root .mw-selflink { text-decoration: none; }

Bolded self-links are usually undesirable, except within navigation templates, where the self-link-produced boldface helps locate the article within the template. In some cases, such as with templates that are not navigation templates, and that are transcluded into several pages, self-links can be actively suppressed by enclosing the link within the template {{No self link}}.

A link to a section of the same article, even from the same section, does not produce bold text and works as a normal link. For example, [[Help:Link#Self link]] → Help:Link#Self link. Such section links should usually be written without the page name ([[#Self link]] → #Self link), because this method does not cause the page to reload if the reader initially arrived at the page via a redirect, and is thus more efficient. A useful application is links from article leads or overview sections to detail sections buried deeper in the same article. An automatically generated table of contents has links to sections on the page.

A self-link is indirect if it links to a page that redirects back. In this case, the page name is technically different, so the link is not bolded: [[Self link]] → Self link. If the link contains the prefix for the same project, the self-link feature works as intended: [[en:Help:Self link]] → en:Help:Self link.

Some types of wikilink target pages result in special behavior:

  • [[File:Mediawiki.png]] renders the linked image on the current page.
  • [[Category:Help]] adds the current page to the linked category.
  • [[fr:Aide:Liens]] creates a meta interlanguage link to the same article within a different language Wikipedia.

When targeting these page types, the special behavior can be suppressed to display a regular wikilink by prepending a colon character : to the target page:

Less common ways in which link targets are reinterpreted are described below in #Conversion to canonical form.

Editing tools

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 the