FANDOM


File:How to link text.ogv

This page, Help:Link explains how to make wikilinks, interwiki links, or external web links (as hyperlinks) in Wikipedia, which give readers one-click access to other Wikipedia pages, other Wikimedia projects, and external websites.

For a short list of some basic shortcuts, see Cheatsheet.

For guidelines on how links should be used in Wikipedia, see Wikipedia:Manual of Style/Linking.

Wikilinks Edit

A wikilink (or internal link) links a page to another page within English Wikipedia. Links are enclosed in doubled square brackets like this:

  • [[abc]] is seen as "abc" in text and links to page "abc".

Use a vertical bar "|" (the "pipe" symbol – see Wikipedia:Piped link for how to type one) to create a link while labeling it with a different name on the original page. The first term inside the brackets is the link (the page you would be taken to), while anything you type after the vertical bar is what that link looks like on the original page. Here are some examples:

  • [[a|b]] is labeled "b" on this page but links to page "a".
  • [[a]]b gives ab. So does [[a|ab]]: ab. [[a|b]]c gives bc, just like [[a|bc]] does. However, all four of these examples will link to page "a".
  • a[[b]] gives ab.
  • [[a]]:b gives a:b since the colon is outside the end brackets. The same goes for [[Washington]]'s or e-[[mail]].
  • [[a]]''b'' gives ab. (Double single quotes turn on and off italics.)
  • ''[[a]]''b gives ab.
  • [[a|b]]cd gives bcd.


Links with a specified label are said to be "piped" because the pipe symbol is used ("|"). For certain types of link, the label will be generated automatically if a pipe is typed, even with no label after it (meaning you don't have to type one). See Help:Pipe trick.

The link target is case-sensitive except for the first character (so [[atom]] links to "Atom" but [[ATom]] does not). Other ways in which link targets are reinterpreted are described below under: Conversion to canonical form.

If the target of a wikilink does not exist, it is displayed in red color, and is called a "red link". If a red link is clicked, the user is taken to a blank page where it is possible to create a page using that redlinked title. While on that blank page, other red links to this (non-existent) title can be detected using the "What links here" feature.

If the target of a link is the same as the page on which it appears (a self-link), it is displayed in bold font, as with: Help:Link.

Attempting to link normally to an image page, category page or interlanguage link will produce a different effect: this will respectively place the image on the page, add the page to the category, or create an interlanguage link at the edge of the page. To override this behavior, add an initial colon ":", as in [[:File:Mediawiki.png]], [[:Category:Help]], [[:fr:Help:Link]].

Interwiki links Edit

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 [[...]] syntax as wikilinks (see above), but take a prefix ":x:" which specifies the target site.

For example, [[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), [[:ja:Wikilink|]] would be used to link to Wikilink on Japanese Wikipedia. Example: ([[:ja:URL|]] links to URL on Japanese Wikipedia).

Interwiki links (like external links) are displayed in a slightly paler blue than ordinary wikilinks. The MediaWiki page formatting does not detect whether these target pages exist, so they are never displayed in red.

External links Edit

External links use absolute URLs to link directly to any webpage. These links have the associated CSS class "external". External links are in the form [http://www.example.org link name] (resulting in link name), with the link name separated from the URL by a space and followed by an external link icon. Links without link names appear numbered: [http://www.example.org] becomes: [1]. Links with no square brackets display in their entirety: http://www.example.org.

See Linking to URLs for more detailed information.

Special:LinkSearch finds all pages linking to a given site.

The external link syntax can also be used to link to particular page versions within Wikipedia that are not accessible by wikilinks, such as page history, edit view, an old version of a page, the diff between two versions, etc. It can also be used to create a navigational image .

To display a link without the arrow icon, place the external link syntax between <span class="plainlinks">...</span> tags.

Registered users at the English Wikipedia can select "Open external links in a new tab/window" under Gadgets at user preferences. It is not possible to make an external link open in a new tab/window for others.

Dropping http: and https: Edit

If you make an external style link using square brackets [...] from a Wikimedia page to other Wikimedia page, including Wikipedia of course, it's better to drop the protocol http: or https:, so that the URL begins with //..., e.g. //en.wikipedia.org/w/index.php?title=Help:URL.

Otherwise, readers are forced to use the specified connection method. If you don't specify the protocol, readers can continue to use the protocol to read that page.

The URL returned by Template:Tnull magic word begins with //.

  • Example: [//en.wikipedia.org/w/index.php?title=Help:Link no protocol]
  • Result: no protocol (Read this page both with http and https.)

What is an "anchor"?Edit

An "anchor" is a landing place for a link to jump to. The process involves the wiki-software automatically creating usually-invisible code from certain text in the "landing place", such as certain parameters in reference templates. In Wikipedia, the term "anchor" may refer to the landing place in general, to usually-invisible code, or to the text and parameters from which the code is created.

Section linking (anchors) Edit

Shortcut:

To link to a section in the same page, you can use: [[#section name|displayed text]], and to link to a section in another page: [[page name#section name|displayed text]].

The section title in fact points to an anchor on the target page. It may be preferable to define anchors other than explicit section titles, using the HTML code <span id="anchor_name">...</span>, or the template {{Anchor|anchor name}} (see {{Anchor}} syntax). To create an anchor for a row of a table see Help:Table#Section link to a row. However [[#top]] and [[#toc]] are reserved names that link to the top of a page and the table of contents, respectively.

Section links still work if the wikilink is a redirect (for example, if Danzig redirects to Gdańsk, then Danzig#History will link to the "History" section of the article Gdańsk). It is also possible to put section links inside redirects (these work only if JavaScript is enabled). For example, Wikipedia:Section link redirects to Help:Link#Section linking (anchors) using #redirect processing. Note that an explicit section link overrides any section link in a redirect, so Wikipedia:Section link#Interwiki links will go to the "Interwiki links" section of this page.

For more information, see Help:Section. See also WP:TARGET.

Anchor links can also be added to external URLs and to interwiki links, again using the # syntax. Note that if the page name is automatically converted, then the section link still works, but disappears from the address bar (this makes it more difficult to bookmark the section itself).

Subpage linksEdit

Except in main namespace (article namespace), where the subpage feature has been disabled in the English Wikipedia, subpages are pages separated with a "/" (a slash) from their 'parent' page.

Inside a subpage hierarchy the following relative links can be used:

  • [[../]] links to the parent of the current subpage, e.g., on A/b it links to A, on A/b/c it links to A/b.
  • [[../../]] links to the grandparent of the current subpage, e.g., on A/b/c it links to A.
  • [[../s]] links to a sibling of the current subpage, e.g., on A/b, it links to A/s.
  • [[../../s]] links to an "uncle" of the current subpage, e.g., on A/b/c, it links to A/s.
  • [[/s]] links to a subpage, e.g. on A it is the same as [[A/s]]. Because of this, linking from a namespace where the subpage feature is enabled to a page in the main namespace with a name starting with "/", requires a workaround: put a colon before the pagename.

Linking to an anchor of an ancestor does not work. Attempting it gives a link to a page with the name consisting of the name of the ancestor followed by "/".

Relative links still work if all pages of a tree are renamed according a name change of the root, including making it a child of a new root.

See also the example pages m:Link/a/b and m:Help:Link/a/b.

ISBN, RFC and PMID automatic linksEdit

Links to these items are generated automatically, with no need to insert square brackets:

To prevent such automatic linking, use <nowiki>...</nowiki> tags around the text.

Piped linkEdit

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. 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 box and is also shown in the status bar.

For instance:

[[coffeehouse setup|How to set up a coffee house]]
will show: How to set up a coffee house

Another example would be [[train station|station]] rendering as station. This is useful where the word "station" is used in an article on trains; from the context, it would be clear that a train station is meant. The piped link is more convenient to the user than a link to station which might be a disambiguation page.

The term piped refers to the use of the pipe character "|" used to separate the good description from the actual link. This character is named after an alternative use of it; see Pipe (computing).

Using a redirect as an alternativeEdit

An alternative is simply using redirect pages. 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 (note that, unlike above, what pops up when you point at the link, if applicable for your browser, is simply the text already shown).

This is convenient if the redirect is already there or will also be of use elsewhere; however, there are a few drawbacks:

  • the popup does not show the page one will arrive at
  • "Related changes" gives the changes in the redirect page not the redirect target
  • the redirect message on the target page slightly clutters it

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 box, such as the value of a unit in terms of other units. In that case one can make a page whose pagename is the info one wants in the link title, and which redirects to a page with a more appropriate name. See e.g. w:Template:Ft, containing [[30.48 cm|ft]], with the page w:30.48 cm redirecting to w:Foot (unit of length).

Automatic conversion of the wikitextEdit

Pipe trickEdit

If in a piped link the part after the "|" is left empty, it is converted to an abbreviated form of the page name on the left, as follows:

  1. 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".
  2. if there is text in parentheses at the end it will be removed
  3. if there are no parentheses but there is a comma, the comma and everything after it is removed
  4. 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 of subst, 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.

ExamplesEdit
ColonEdit
  • [[Help:Template|]] is converted to [[Help:Template|Template]], which is rendered as Template.
  • [[Music: My life|]] is converted to [[Music: My life| My life]], which is rendered as My life - although "Music:" is not a namespace (therefore the space after the colon is not automatically removed), the shortcut works anyway.
  • [[w:en:Pipe (computing)|]] is converted to [[w:en:Pipe (computing)|en:Pipe]], which is rendered as en:Pipe.
CaseEdit
  • [[pipe (computing)|]] is converted to [[pipe (computing)|pipe]] which is rendered as pipe.
  • [[Pipe (computing)|]] is converted to [[Pipe (computing)|Pipe]] which is rendered as Pipe.
CommaEdit
  • [[commons:Boston, Massachusetts|]] is converted to [[commons:Boston, Massachusetts|Boston]], which is rendered as Boston.
OtherEdit

Parameters and variables:

  • [[w:{{{1}}}|]] does not give [[w:{{{1}}}|{{{1}}}]].
    Calling the template with a value of parameter 1 gives a working link in the case of substitution only.
  • [[w:en:{{FULLPAGENAME}}|]] does not give [[w:en:{{FULLPAGENAME}}|en:{{FULLPAGENAME}}]].
    [[m:{{FULLPAGENAME}}|]] does not give [[m:{{FULLPAGENAME}}|{{FULLPAGENAME}}]]

See also Limitation below.


*[[project:a (b)|]]
*[[w:project:a (b)|]]
*[[:de:project:a (b)|]]
*[[wiktionary:project:a (b)|]]
*[[wiktionary:de:project:a (b)|]]
*[[wikibooks:project:a (b)|]]
*[[wikiquote:project:a (b)|]]
*[[wikisource:project:a (b)|]]
*[[w:en:{{FULLPAGENAME}}|]]
**[[w:en:{{FULLPAGENAME}}|en:{{FULLPAGENAME}}]]
*[[m:{{FULLPAGENAME}}|]]
**[[m:{{FULLPAGENAME}}|{{FULLPAGENAME}}]]

Which looks like:

Category tagEdit

The sortkey syntax of the category being like a piped link, the pipe trick also works for category tags, even though it is not useful there.

LimitationEdit

  • [[Help:L{{tc}}k|]] using Template:Links-small is not converted, so the result is rendered as [[Help:LTemplate:Tck|]] and not as a working link. This is because the pipe trick expansion, like substitution, occurs before ordinary expansion of templates, etc., while the pipe trick does not work if the linked page contains invalid characters. Thus while ordinarily the acceptability of the target page name is judged after template expansion, the pipe trick expansion judges it before, the braces are considered invalid characters in the page name. Instead one can use a template like Template:Links-small: {{pipe trick|Help:|L{{tc}}k}} gives Template:Pipe trick.

Inverse pipe trickEdit

On page "A (c)", [[|b]] is automatically converted to [[b (c)|b]].

Similarly, on page "A, c", [[|b]] is automatically converted to [[b, c|b]].

For examples, see here.

Changing link appearanceEdit

The ways that various links are displayed in browsers, as described above, are the default display styles in the default skin. Users can change the way they see links:

  • By selecting a different skin;
  • By applying a user style using CSS;
  • By changing the "Underline links" or "Format broken links like this" value on the Appearance tab of user preferences;
  • By setting the "threshold for stub display" on the Appearance tab of user preferences. This causes links to pages in mainspace to be displayed in a distinctive fashion – dark red by default – if the wikitext of the target page has less than a specified number of bytes. (Any section markers in the link are ignored. Links to redirects are displayed in the normal style).

Hover boxes Edit

In many browsers, holding the cursor over a link (mouseover) shows a hover box (tooltip) containing the text of the link's HTML title attribute. MediaWiki 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 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 address 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 box without a link, using the {{H:title}} template.

Disallowed characters Edit

A link whose target contains disallowed characters (see WP:Page name) will be displayed without markup, as in [[A{b}]].

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".

A code like %70 in a redirect disables it, although the link works from the redirect page. For a redirect that works, the redirect page shows the canonical form of the target, unlike its preview page, which renders the link in the usual way.

Links containing URL query stringsEdit

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.

The following syntax shows the use of the magic word fullurl as it would appear in a template constructed to append action=edit to the URL query string:

[{{fullurl:{{{1}}}|action=edit}} {{{1}}}]

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.

Links to and from a page Edit

To list pages which link to the current page (backlinks), use the What links here feature. The {{orphan}} tag can be placed on pages with no incoming links.

To make the current page show up at "What links here" for a certain other page without creating a working link to that other page, use a link with a space following the pipe, as in [[Main page| ]].

To list all pages which are linked from a particular page, enter the following URL, using the page title (with spaces replaced by underscores) in place of PAGENAME:

http://en.wikipedia.org/w/api.php?action=query&prop=links&pllimit=500&titles=PAGENAME

The number of links returned is limited to 500.

Additional link-related functions Edit

For the effect that links have on date formatting, see Help:Date formatting and linking.

Another link-dependent feature is Related changes, which makes 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 {{tl}} and {{tlx}} for linking to templates, and {{cl}} and {{lc}} for linking to categories. More can be found in Category:Internal link templates.

Conversion to canonical form Edit

As described above, 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 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.

Also, HTML character references and percent-encoded characters are replaced with their raw character. For example, [[d&eacute;partement]] produces département, and [[%40]] produces @. 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 above) in the following places:

  • in transclusion tags for non-existent pages: {{qwsazx}} gives Template:Qwsazx;
  • in pop-ups and on 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 Edit


Links are foundational to a wiki. They let your readers click from one page to another — and thus explore your content easily. It's such a central part of wikis that the process of creating links is also known as wikification.

Make sure that all your pages have links to other pages on your wiki. However, not all links on a page need to go to other pages.

Using Fandom's visual editors

Link dialog

This is the pop-up that will appear when you click the link button in Fandom's classic rich-text editor.

VisEdLinks

In the VisualEditor, the process is similar, but there's only one field — for the target page. This field will accept either pages on the current wiki, as seen above, or URLs for external links.

To create a link, click on the edit button and follow these instructions:

  • Begin by highlighting the text you want to link.
  • Then click on the Link button button on the toolbar.
  • A window will pop up which will allow you to create links.
    • In our classic rich-text editor, this window gives you two options for linking: an internal link or an external link. Internal links are pages within the wiki (or to another Fandom wiki). External links are to pages outside of Fandom. Select which one you need.
    • In our VisualEditor, the window doesn't present options for linking. You can use the same field for either type of link.
  • Enter the target of the link. For an internal link, enter the name of the page. For an external link, enter the full URL (including the "https://" part).
  • Make sure the text that should display for the link looks right. It should be displaying the text you highlighted earlier.
  • Click "OK". Your link will appear!

Using source mode

Source editing differs significantly from the approach offered by Fandom's visual editors. However, it also allows you the ability to link in many more sophisticated ways via wikitext. There are so many interesting details about linking in source that we've created a whole page about it!

Important notes

  • Until you're confident making links, don't forget to preview your changes before you save.
  • On most wikis, if your new link is red in the preview, either that destination does not exist or you typed it incorrectly. If you click on the red link, you will be asked to create the page.
  • Adding a link that goes to the current page appears as bold text instead of a link when viewing the page.

See also

Further help and feedback

Community content is available under CC-BY-SA unless otherwise noted.