Help:Links
From NSDLWiki
There are four sorts of links in MediaWiki:
- internal links to other pages in the wiki (See also Anchor links)
- external links to websites
- inter-wiki links (links to other wikis)
- inter-language links to other language versions of the same wiki
To add an internal link, enclose the name of the page you want to link to in double square brackets. When you save the page, you'll see the new link pointing to your page. If the page exists already, it is displayed in blue, empty pages are displayed in red. Selflinks to the current page are not transformed in URLs but displayed in bold.
The first letter of the target page is automatically capitalized and spaces are represented as underscores (typing an underscore in the link will have a similar effect as typing a space, but is not recommended, since the underscore will also be shown in the text).
Contents[hide] |
How to link
Description | You type | You get |
Internal link | [[Main Page]] | Main Page |
Category link | [[:Category:Help]] | Category:Help |
Piped link | [[Main Page|different text]] | different text |
Anchor link | [[#Linking_to_anchors|Anchor link]] | Anchor link |
External link | http://mediawiki.org | http://mediawiki.org |
External link, different title | [http://mediawiki.org MediaWiki] | MediaWiki |
External link, unnamed | [http://mediawiki.org] | [1] |
External link, same host unnamed | [http://{{SERVERNAME}}/pagename] | [2] |
Interwiki link | [[Wikipedia:MediaWiki]] | Wikipedia:MediaWiki |
mailto | mailto:info@example.org | mailto:info@example.org |
mailto unnamed | [mailto:info@example.org] | [3] |
mailto named | [mailto:info@example.org info] | info |
redirect | #REDIRECT [[Main Page]] | → Main Page |
Linking to anchors
Links of the form [[#anchor_name]]
will link to the first anchor on the page matching that "anchor_name", usually the first identical section heading.
An #anchor_name can also be appended to the page name in any type of link, thus linking to the first identical section heading (or anchor) of the named page:
[[Help:Editing#Linking_to_anchors]]
http://meta.wikimedia.org/wiki/Help:Editing#Links
Automatic anchors
Section headings automatically act as anchors, with the heading text as the "anchor_name". In the case of multiple sections with identical headings, the anchor name of each has "_2", "_3", etc. appended, starting from the second occurrence.
Manual anchors
Manually-set anchors are useful for linking to "unlinkable" things like a table (title or cell), a section of plain text, etc.
There are a number of ways to set an anchor at an arbitrary position:
- Generic anchor:
<span id="anchor_name">some text</span>
. For a hidden anchor, omit the text.
- In some cases, inserting an HTML-like ID attribute into an (existing) Wiki-element. For example, from the How_to_link_table_id table above:
!colspan="5" align="left" id="How_to_link_table_id"
- The reserved name
[[#top]]
always links to the top of a page.
Information adapted from: