Jump to content

Help:Link

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

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