Jump to content

User:Degine/NeoWiki/Help:Contents/Links

From Wikipedia, the free encyclopedia
Links

This page, Help:Contents/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.

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 "|" 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 [[NeoWiki]]'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).

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.

Attempting to link normally to an image page will produce a different effect: this will respectively place the image on the page To override this behavior, add an initial colon ":", as in [[:File:Mediawiki.png]].

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 Special:Interwiki 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 [[WP:Athens]] links to page "Athens" on WP:Wikipedia as: WP:Athens.

Interwiki links can be piped, just as with wikilinks.

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

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.

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.

There are three forms of external link syntax:

  • If the URL is simply included in the wikitext, without square brackets, then it appears as written, and a hyperlink is created: http://meta.wikimedia.org/ produces http://meta.wikimedia.org/
  • If the URL is placed in square brackets, then a hyperlink is created with a serial number as its label: [http://meta.wikimedia.org/] gives [2]
  • If the URL is placed in square brackets followed by a space and some text, then that text is used as the label for the hyperlink: [http://meta.wikimedia.org/ Wikimedia] gives Wikimedia

Making a link to elsewhere on the same server as the wiki can be simplified by using {{SERVER}}. Example: [{{SERVER}}/relative/url].

To suppress the external link icon, place the external link between <span class="plainlinks">...</span> tags.

  • The URL must start with a supported URI scheme. http://, https:// and file://are always supported. gopher://, irc://, ircs://, ftp://, news:// and mailto: will create a link and an icon but require an agent registered in the browser.
  • URLs containing certain characters will display and link incorrectly unless those characters are percent-encoded. For example, a space must be replaced by %20.
sp " ' , ; < > ? [ ]
%20 %22 %27 %2C %3B %3C %3E %3F %5B %5D
Single apostrophes do not need to be encoded; but unencoded multiples will be parsed as italic or bold markup
  • The link button on the enhanced editing toolbar will encode a link.
  • Titles containing certain characters will display and link incorrectly unless those characters are encoded with HTML character references.
newline [ ] |
space &#91; &#93; &#124;

Section linking (anchors)

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. 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, WP:Wikipedia:Section link redirects to WP:Help:Link#Section linking (anchors). N

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

Except in main article namespace, where the subpage feature has been disabled , 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.