Hyperlinks allow users to move between pages. For some basic information about using hyperlinks, see Help:Editing#Links, URLs. There are three general types of hyperlinks recognized by MediaWiki, each with associated CSS formatting to distinguish them.
A wikilink or internal link links a page to another page within the same project. These links are in the form
[[page name|link name]], where the link name is optional. For example,
[[Main Page]] becomes Main Page, and
[[Main Page|index]] becomes index. Links with parameters (the link name) are said to be "piped" because of the pipe symbol used ('|').
MediaWiki automatically checks if the target of a wikilink exists. If the page doesn't exist, the link leads to the editing screen, and it is assigned the class "new". Such wikilinks are nicknamed "red links" because they are colored red in the default stylesheet on a default installation of MediaWiki. Red links are useful in determining the current status of the page (created or not created), create incoming links to a future page, facilitates and incites page creation.
Note that the image, category, and interlanguage syntax are the same as the wikilink syntax. Attempting to link normally will place the image on the page, add the page to the category and create an interlanguage link at the edge of the page. This can be prevented by prefixing a colon, which escapes the specific syntax. For example,
A wikilink to an existing page will be in class 'stub' if the page is in the main namespace, it is not a redirect, and the number of bytes of the wikitext is less than the "threshold for stub display" set in the user's preferences.
This allows users to immediately identify links to very short pages that probably need to be expanded. Alternately, a user may set a very high threshold to achieve any of the following:
- Identify links to very large pages. However, the criterion is the size of the wikitext; possible inclusion of templates and images can make the rendered page large, even if the amount of wikitext is small.
- Determine at a glance whether a link leads to the main namespace or not. However, this does not take into account redirects to the main namespace (even if the redirect itself is in the main namespace).
- Identify links to redirects, for clean-up work such as bypassing redirects.
However, section linking to a "stub" does not work. Although this is normally a minor issue, this may cause problems with users who set a very high threshold.
An interwiki link links a page to a page on another website. Unlike the name suggests, the target site need not be a wiki, but it has to be on the interwiki map specified for the source wiki. These links have the associated CSS class "extiw". These are in the same form as wikilinks above, but take a prefix which specifies the target site. For example, on Wikimedia projects and many other wikis
[[wikipedia:Main Page]] links to Wikipedia's main page. The prefix can be hidden using the same piped syntax as wikilinks.
Although interwiki links can be used to point to a wiki from itself, this is not generally recommended. MediaWiki does not detect whether or not the target page of an interwiki list exists, so there is no special formatting and the link is always to the view page. Further, MediaWiki does not check if the page is linking to itself. A self wikilink is bolded (like Help:Link), whereas a self interwiki link is normal (m:Help:Link).
- A copy of the wikitext on a sister project may still point to the same page. Sometimes two prefixes are needed for that purpose, e.g. w:de:a.
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. Links without link names will be numbered:
[http://www.example.org] becomes . Links with no square brackets will be displayed in their entirety: http://www.example.org .
See URLs in external links for more detailed information.
Special:Linksearch finds all pages linking to a given site.
External links are often used to use special URL parameters in links. This allows links directly to the edit history of a page, to a page in edit view, a diff of two versions, et cetera. They can also be used to create a navigational image.
However, the use of external links to link to a normal page on the same project is not recommended. These links benefit from none of the features of a wikilink, and may break the web of links when the content is exported to another domain.
Links in the form
[[#anchor_name]] will link to any anchor named "anchor_name" on the page. This may be either a heading named "anchor_name", or an arbitrary position.
[[#top]] is a reserved name that links to the top of a page. It is possible to create an arbitrary anchor name using the HTML code
Anchor links can also be appended to any type of link; for more information, see Help:Section#Section_linking.
Problems with page name conversion
Note that if the page name is automatically converted (for example, from "/wiki/main Page" to "/wiki/Main Page"), the section link will still work but will disappear from the address bar. As a consequence, this will make it more difficult to bookmark the section itself. This is not applicable for wikilinks, because the conversions have already taken place on Preview or Save of the referring page.
For example, consider http://en.wikipedia.org/wiki/Wikipedia:how_to_edit_a_page#Links_and_URLs. In this case, the anchor part of the address will disappear because the "how" will be converted to "How".
A redirect to a page section does not go to the section. However, one can add the section anyway as a clarification, and it will work if the redirect is manually clicked from the redirect page. However, links with a section to a redirect will lead to the section on the redirect's page.
MediaWiki has a subpage feature, although activation depends on project and namespace. If activated, the following applies (if not, "A/b" is just a page with that name).
A tree structure of pages is established by using forward slashes in pagenames: A/b is a child of A, hence A is a parent of A/b; also A/b/c is a child of A/b; A/a, A/b, and A/c are siblings.
At the top of the subpage body links to all ancestor pages are shown automatically, without any corresponding wikitext. The links show up even if the child page does not exist, but the sequence of ancestors stops before any non-existing ancestor page (e.g., if the grandparent page does not exist, the parent page is not shown either). Like most letters of a page name, the first letter after the slash is case-sensitive; "/subpage" and "/Subpage" are different pages.
Relative links still work if all pages of a tree are renamed accor