Help/Links
<languages/>
<translate> Links are used to reference pages within MediaWiki, other wikis, or external websites.
There are five types of hypertext links in MediaWiki: </translate>
- <translate> [[<tvar name=internal>#Internal links</tvar>|Internal links]] to other pages in the same wiki (commonly called "wikilinks")</translate>
- <translate> [[<tvar name=external>#External links</tvar>|External links]] to pages at other websites</translate>
- <translate> [[<tvar name=external2>#External links to internal pages</tvar>|External links to internal pages]] in the same wiki</translate>
- <translate> [[<tvar name=interwiki>#Interwiki links</tvar>|Interwiki links]] to other websites using special prefixes registered in advance</translate>
- <translate> [[<tvar name=interlang>#Interlanguage links</tvar>|Interlanguage links]] to other wikis registered as different language versions of the current wiki</translate>
<translate> Please note that this list does not include [[<tvar name=1>Special:MyLanguage/Help:Categories</tvar>|category links]] and [[<tvar name=2>Special:MyLanguage/Help:Images</tvar>|file links]], which are used to place pages into categories and display images or other media files, respectively. </translate>
<translate>
Internal links[edit]
</translate> <translate> To [[<tvar name=1>Special:MyLanguage/Help:Editing pages</tvar>|create]] a so-called internal link to a page on the same wiki (a "wikilink"), use double square brackets wiki markup, .</translate> <translate> When you preview or save your changes, you will see a link that can be followed to the target page.</translate> <translate> If the page exists, the link is displayed in blue (like the word "create" in the first sentence of this paragraph); if the page does not exist, the link appears red (so the link is actually rendered ).</translate> <translate> Note that the colors could be different if the color scheme of the wiki has been changed from the default.</translate> <translate> Following such a "redlink" to a missing page (whether or not it is actually red) will usually enable the user to create the page.</translate>
<translate> To markup any arbitrary string of text (not necessarily a page title) as a link, use a "vertical bar" or "pipe" character, like this: $1]]</tvar>|category links}} results in the link . </translate>
<translate> The first letter of the link target is usually not case-sensitive (unless the wiki is configured otherwise), meaning links can be capitalized or not (so How to contribute and how to contribute are equivalent).</translate> <translate> However, the case of every subsequent letter must match the target page exactly (so How to contribute and How To Contribute are not equivalent).</translate> <translate> Spaces in the page title may be represented as underscores (so How to contribute and How_to_contribute are again equivalent), but using underscores in links will make them visible in the page text (but this can be prevented by using a "pipe").</translate>
<translate> If the page title you are linking to is that of the page you are editing, the result is not a hyperlink at all but simply bold text (for example, on this page the markup <tvar name=1>[[]]</tvar> gives the result <tvar name=2>[[]]</tvar>).</translate>
<translate> If you're trying to create a wikilink to the current page, you probably want to link to a specific section or to an anchor within the page; see the examples below.</translate>
<translate> MediaWiki uses the <tvar name=1></tvar> table to keep track of internal wikilinks. </translate>
<translate> Unlike external links, internal links do not support the use of URL query parameters.</translate> <translate> The addition of HTML attributes is not supported by either internal or external links.</translate>
| <translate> Name</translate>/<translate> Description</translate> | <translate> Syntax</translate> | <translate> Result</translate> |
|---|---|---|
| <translate> Internal link</translate> | <syntaxhighlight lang="mediawiki">
Extension:DynamicPageList (Wikimedia) </syntaxhighlight> |
|
| <translate> Piped link</translate> |
<syntaxhighlight lang="mediawiki">editing help</syntaxhighlight> <translate> Links to a section/anchor within the target page.</translate> <syntaxhighlight lang="mediawiki">previewing</syntaxhighlight> <translate> Piped link to an anchor on the same page</translate> <syntaxhighlight lang="mediawiki">different text</syntaxhighlight> <translate> See also [[<tvar name=meta>Special:MyLanguage/Help:Links#Piped links</tvar>|Help:Piped link]].</translate> |
|
| <translate> Pipe trick</translate> | <syntaxhighlight lang="mediawiki">
DynamicPageList </syntaxhighlight> <translate> The transformation done by the pipe trick can result in the same text for different link targets, as seen in the DynamicPageList examples.</translate> |
|
| <translate> Word-ending links</translate> | <syntaxhighlight lang="mediawiki">
Helpalmostanylettersyoulikehere HelpBUTnotalways </syntaxhighlight> <translate> Follows so-called "linktrail rules" [[<tvar name=loc>Special:MyLanguage/Localisation</tvar>|localised]] per [[<tvar name=msgxx>Special:MyLanguage/MessagesXx.php</tvar>|each language]].</translate> |
Helpalmostanylettersyoulikehere HelpBUTnotalways |
| <translate> Avoiding word-ending links</translate> | <syntaxhighlight lang="mediawiki">
Helpful advice GPLv3 </syntaxhighlight> |
Helpful advice GPLv3 |
| <translate> Link to an anchor on the same page</translate> | <syntaxhighlight lang="mediawiki">#See also</syntaxhighlight>
<translate> Anchors are provided automatically on [[<tvar name=formatting>Special:MyLanguage/Help:Formatting</tvar>|section headings]] and to the [[<tvar name=1>#top</tvar>|top]] (<tvar name=2> |
#See also |
| <translate> Setting an anchor for incoming links</translate> | <syntaxhighlight lang=html>
optional text
optional text </syntaxhighlight> <translate> Rendered block-level and inline, respectively.</translate>
<translate> Doing this would allow for <translate> Setting an anchor in a section heading </translate> <syntaxhighlight lang=html> Section heading[edit]</syntaxhighlight> <translate> Note the placement.</translate> <translate> This must be a "span" tag, not a "div".</translate> <translate> (Such anchors allow sections to be retitled without breaking incoming links.)</translate> |
<div id="<translate nowrap> Unique anchor name 1</translate>"><translate> optional text</translate>
<span id="<translate nowrap> Unique anchor name 2</translate>"><translate> optional text</translate> |
| <translate> Link to an anchor at another page</translate> | <syntaxhighlight lang=mediawiki>Help:Images#Supported media types for images</syntaxhighlight> | Help:Images#Supported media types for images |
| <translate> Link to the current page's talk page</translate> | <syntaxhighlight lang=mediawiki>Discussion</syntaxhighlight>
<translate> See also [[<tvar name=page-names>Special:MyLanguage/Help:Magic_words#Page_names</tvar>|Help:Magic words#Page names]]</translate> |
Discussion |
| <translate> Link to a subpage.</translate> <translate> Can only be used on pages inside a namespace where subpages are enabled.</translate> | <syntaxhighlight lang=mediawiki>/example</syntaxhighlight>
<translate> Shortcut for <tvar name=1><syntaxhighlight lang="mediawiki" inline>/example</syntaxhighlight></tvar>.</translate> <translate> See also <tvar name=1></tvar>.</translate> |
/example |
| <translate> Link to a subpage without the leading slash.</translate> <translate> Can only be used on pages inside a namespace where subpages are enabled.</translate> | <syntaxhighlight lang=mediawiki>/example/</syntaxhighlight>
<translate> Shortcut for <tvar name=1><syntaxhighlight lang="mediawiki" inline>example</syntaxhighlight></tvar>.</translate> |
example |
| <translate> Link to a subpage of parent page for current page.</translate> <translate> Can only be used on subpages.</translate> | <syntaxhighlight lang=mediawiki>[[../example2]]</syntaxhighlight>
<translate> Shortcut for <tvar name=1><syntaxhighlight lang="mediawiki" inline>example2</syntaxhighlight></tvar> if you post the link on <tvar name=2><syntaxhighlight lang="mediawiki" inline>example</syntaxhighlight></tvar> page.</translate> |
example2 |
| <translate> Visible link to a category page</translate> | <syntaxhighlight lang=mediawiki>Category:Help</syntaxhighlight>
<translate> Without the leading colon the link would not be visible and the page would instead be placed into the category; this is a very common mistake.</translate> <translate> See also <tvar name=1></tvar>.</translate> |
Category:Help |
| <translate> Visible link to an image or media file</translate> | <syntaxhighlight lang=mediawiki>
file label </syntaxhighlight> <translate> Without the leading colon on the "File:" examples, the images would actually be displayed.</translate> <translate> See also <tvar name=1></tvar>.</translate> <translate>
The <tvar name=1> |
|
| <translate> Link to a page specific to each reader (user page, etc.)</translate> | <syntaxhighlight lang=mediawiki>
Special:Preferences </syntaxhighlight> |
|
| <translate> Internal link to a specific revision</translate> | <syntaxhighlight lang=mediawiki>Special:PermanentLink/2393992</syntaxhighlight>
<translate> Revision numbers can be found in each page's [[<tvar name=h-hist>Special:MyLanguage/Help:History</tvar>|edit history]].</translate> <translate> (It is very common to see links to specific revisions implemented as external links because it's easy to cut-and-paste an entire URL to form an external link.)</translate> |
Special:PermanentLink/2393992 |
| <translate> Internal link to a "diff"</translate> | <syntaxhighlight lang=mediawiki>
Special:Diff/2390639/2393992 </syntaxhighlight> <translate> The default (in the first example above) is to show the changes from the previous revision.</translate> <translate> See also the comments in the previous item.</translate> |
|
| <translate> Redirect</translate> | #REDIRECT [[Main Page]] <translate> Should be the first line on the page.</translate> <translate> See <tvar name=1></tvar>.</translate> |
File:Redirect arrow without text (cropped).svg Main Page |
<translate>
External links[edit]
</translate> <translate> To [[<tvar name=h-edit>Special:MyLanguage/Help:Editing pages</tvar>|create]] an external link, usually to a page at a different website, enclose the URL followed by space and the link text in single square brackets (see examples below).</translate> <translate> When you save or preview the page, you will see a link rendered slightly differently than an internal wikilink.</translate> <translate> It may be a different color and/or be followed by an arrow icon to show that it may lead to another site.</translate>
| <translate> Description</translate> | <translate> You type</translate> | <translate> You get</translate> |
|---|---|---|
| <translate> External link with specified link text</translate> | [https://mediawiki.org MediaWiki] |
MediaWiki |
| <translate> Numbered external link</translate> | [https://mediawiki.org] <translate> This is what happens if you omit the link text.</translate> <translate> Multiple links of this type on the same page are numbered sequentially.</translate> |
[1] |
| <translate> Bare external link</translate> | https://mediawiki.org <translate> URLs beginning with "<tvar name=1> |
https://mediawiki.org |
| <translate> Avoiding auto-linking of URLs</translate> | <syntaxhighlight lang=html>https://mediawiki.org</syntaxhighlight> | https://mediawiki.org |
| <translate> Protocol-relative external link</translate> | [//en.wikipedia.org Wikipedia] [//en.wikipedia.org //en.wikipedia.org] <translate> The link will be <tvar name=code1>HTTP</tvar> or <tvar name=code2>HTTPS</tvar> depending on the protocol of the page currently being viewed (which could be different for different users).</translate>
<translate> This is only supported inside of square brackets <tvar name=code3> |
|
| <translate> External link to the current server</translate> | https:///pagename |
https:///pagename |
| <translate> External link to other host passing the pagename</translate> | https://google.com/search?q= <translate> See also:</translate> , |
https://google.com/search?q=Links |
| <translate> Mailto link</translate> | [mailto:[email protected] email me] |
email me |
| <translate> Mailto named with subject line and body</translate> | [mailto:[email protected]?Subject=URL%20Encoded%20Subject&body=Body%20Text info] |
info |
| <translate> Custom URI</translate> | [skype:echo123 call me] <translate> Any URI you wish to add needs to be first declared through <tvar name=UrlProtocols></tvar>.</translate> <translate> (This example is not enabled on mediawiki.org)</translate> |
[skype:echo123 call me] |
<translate>
Using email links[edit]
</translate>
<translate> Email links use <tvar name=1>mailto:</tvar> before the address.</translate>
<translate> They're written like this: (resulting in ).</translate>
<translate> If there's no name, the address is automatically numbered, like this: <tvar name=1>[mailto:[email protected]]</tvar> becomes <tvar name=2>[2]</tvar>.</translate>
<translate> Addresses without square brackets won't be linked, e.g., <tvar name=1>[email protected]</tvar>.
You can also add a CC using (resulting in ). </translate>
<translate> To add a subject, use:</translate>
[mailto:[email protected]?subject=Subject]
<translate>
External links to internal pages[edit]
To add a link to a page on the same wiki using URL query parameters, you may need to use external link syntax. </translate>
| <translate> Description</translate> | <translate> You type</translate> | <translate> You get</translate> |
|---|---|---|
| <translate> External link to the current page's edit page</translate> | [https://www.mediawiki.org/w/index.php?title=Help:Links&action=edit <translate nowrap><!--T:224--> Edit this page</translate>] [|action=edit}} <translate nowrap><!--T:225--> Edit this page</translate>] <translate> See also [[<tvar name=url-data>Special:MyLanguage/Help:Magic_words#URL_data</tvar>|Help:Magic_words#URL_data]] and [[<tvar name=external>#External links</tvar>|External links]] above.</translate> |
<translate> Edit this page</translate> [|action=edit}} <translate> Edit this page</translate>] |
| <translate> External link to the current page's edit page, and styled to look like an internal link</translate> | <syntaxhighlight lang=html>Edit this page</syntaxhighlight>
<translate> The [[<tvar name=1>Special:MyLanguage/Plainlinks</tvar>|plainlinks class]] can be used in cases where you want an external link to look like an internal one, by suppressing the icon that normally appears after it.</translate> |
<translate> Edit this page</translate> |
<translate>
The arrow icon[edit]
</translate> <translate> Some skins add an arrow icon <tvar name=1>File:Link-external-small-ltr-progressive.svg</tvar> after each external link by default.</translate> <translate> However, this can be avoided by using <tvar name=1>class=""</tvar>.</translate> <translate> For instance:</translate>
<translate>
Using Linksearch[edit]
</translate> <translate> <tvar name=1>Special:Linksearch</tvar> is a built-in tool that helps find pages linked to a specific URL.</translate> <translate> By using the <tvar name=1></tvar> table, it generates a comprehensive list of page names where the link originates, along with the complete target link for each source page.</translate> <translate> You can search in all namespaces or just one.</translate> <translate> It supports wildcard (<tvar name=1>*</tvar>) use, so you can search by top-level domain (e.g. <tvar name=2>[3]</tvar>), second-level domain (e.g. <tvar name=3>[4]</tvar>), etc. or refine your search by specifying parts of the URL e.g. <tvar name=4>[5]</tvar>.</translate>
<translate>
Using backlinks[edit]
</translate>
<translate> Normally, internal links within a project are easy to spot and useful for finding related pages.</translate>
<translate> But when there's a mix of internal and external links, it can be tricky to track backlinks, it necessitates the use of both "[[<tvar name=1>Special:MyLanguage/Help:What links here</tvar>|Help:What links here]]" and "<tvar name=2>Linksearch</tvar>".</translate>
<translate> However, for links to specific sections or anchors, it's possible to include both an internal link and, with CSS styling using <tvar name=1>display=none</tvar> an external link to provide backlink.</translate>
<translate> External links are better than interwiki links.</translate>
<translate> With Linksearch, you can even find backlinks to specific sections or anchors.</translate>
<translate> So, combining both internal and external links while hiding the external ones <tvar name=1><span style="display:none">http://...</span></tvar> gives us the best of both worlds.</translate>
<translate>
Limitations[edit]
</translate>
- <translate> External links doesn't support Word-ending links.</translate>
- <translate> External links doesn't count toward <tvar name=1>Special:WhatLinksHere</tvar> ([[<tvar name=2>Special:MyLanguage/Help:What links here</tvar>|What links here]]).</translate>
<translate>
Interwiki links[edit]
</translate>
<translate> Interwiki links are internal-style links to other websites (which do not have to be wikis, despite the name).</translate>
<translate> For example, you can link to the article https://en.wikipedia.org/wiki/Sunflower by typing [[wikipedia:Sunflower]] or, on this wiki, the shorter [[w:Sunflower]].</translate>
<translate> Both will result in a link wikipedia:Sunflower.</translate>
<translate> This works because by default MediaWiki configures wikipedia: as an "interwiki prefix" that turns into https://en.wikipedia.org/wiki/ when used inside [[ ]].</translate>
<translate> (It may not work if the admin of your wiki has changed the setting.) Unlike internal links, interwiki links do not use page existence detection, so an interwiki link will appear blue even if the page does not exist on the remote wiki.</translate>
<translate>
Similar to internal page links, you can create , with alternate link label, e.g. [[wikipedia:Sunflower|big yellow flower]] is the link big yellow flower and [[wikipedia:Sunflower|]] is the link Sunflower.
Basically, interwiki links are abbreviations for commonly-used longer external links. A very similar link could be created as [https://en.wikipedia.org/wiki/Sunflower big yellow flower].
</translate>
<translate> More details are at <tvar name=2></tvar>.</translate> <translate> Your wiki may have a <tvar name=1>Special:Interwiki</tvar> page listing the interwiki prefixes it supports; </tvar>|here is the default interwiki list}}.</translate> <translate> You can edit the <tvar name=1></tvar> table on your site.</translate>
<translate>
Interlanguage links[edit]
If your wiki has other language versions, you may find [[<tvar name=mainill>Special:MyLanguage/Interlanguage_links</tvar>|interlanguage links]] in the [[<tvar name=sidebar>Special:MyLanguage/Help:Navigation#Sidebar</tvar>|sidebar]], just below [[<tvar name=toolbox>Special:MyLanguage/Help:Navigation#Toolbox</tvar>|toolbox]] in a section titled “<tvar name=1>}}</tvar>.” </translate>
<translate> In wiki markup an interlanguage link looks very much like an interwiki link, but behaves similarly to a [[<tvar name=1>Special:MyLanguage/Categorylinks</tvar>|category link]] in that it is rendered in a special way.</translate> <translate> While category links appear in a special list at the bottom of the page (usually), interlanguage links appear in a special list in the [[<tvar name=1>Special:MyLanguage/sidebar</tvar>|sidebar]] of the page (or elsewhere, depending on the wiki's configuration and the [[<tvar name=2>Special:MyLanguage/Manual:Skins</tvar>|skin]] used).</translate>
<translate> The purpose of interlanguage links is to link pages on the same topics in different languages.</translate> <translate> To create an interlanguage link, type anywhere in the page (preferably at the bottom, like category links); the language prefix is the prefix specified at your wiki for the other language version (typically the ISO 639-1 language code).</translate>
<translate> The interlanguage link is unilateral, it does not point back from that page in the other language.</translate>
<translate> For that purpose, an equivalent back-link needs to be placed there as well.</translate>
<translate> It does not work like the <tvar name=1></tvar> in the languages section of Wikipedia-language versions.</translate>
<translate> But it can be used across all namespaces, including <tvar name=1>:</tvar> to point to ones other profiles in other languages.</translate>
<translate> If you want to make the interlanguage link appear at a specific place in the content of the page rather than in the sidebar, add a colon before the language prefix:
[[:en:Sunflower]]→ en:Sunflower
When a link is both interwiki and interlanguage, the order is wikipedia:en:Sunflower.
For more information, see <tvar name=1></tvar>. </translate>
<translate>
Piped links[edit]
</translate> <translate> A piped link is an internal [[<tvar name=1>Special:MyLanguage/Help:Link</tvar>|link]] or [[<tvar name=2>Special:MyLanguage/Help:Interwiki linking</tvar>|interwiki link]] where the 'target page name' of the link and its 'label' are both specified.</translate> <translate> This is useful in cases where the user wants values of 'target page name' and 'label' to be different.</translate> <translate> This also enables linking a contextually relevant word or phrase within the text of a page rather than using the generic value "see also".</translate> <translate> The wording does not need to match the name of the target page.</translate> <translate> Depending on the [[<tvar name=1>Special:MyLanguage/Help:Preferences</tvar>|preferences]] set for the current user and a supported browser, you can still see the link target: when you hover your cursor over the link, the name shows up in a pop-up window and is also shown in the status bar.</translate>
<translate> For example: </translate>
[[coffeehouse setup|Get Piping Hot Coffee Here!]]
<translate> will show:</translate> Get Piping Hot Coffee Here!
<translate> Let's take another example: [[help:Piped link|piped link]] will be displayed as piped link.</translate> <translate> This can be done when context makes it clear that the page being linked to is in the help namespace.</translate> <translate> The piped link is a better way of doing this, rather than mistakenly linking to piped link which might be a disambiguation page or not exist.</translate>
<translate> Fun Fact: The term piped refers to the use of the pipe character "<tvar name="1">|</tvar>", which in this context is used to separate the more descriptive description from the actual name of the linked page.</translate> <translate> The Pipe character was named after an alternative use of it; see Pipe (computing).</translate>
<translate>
Using a redirect as an alternative[edit]
</translate> <translate> An alternative way is to use [[<tvar name=1>Special:MyLanguage/Help:Redirect</tvar>|redirect pages]].</translate> <translate> To create <tvar name="1">Get Piping Hot Coffee Here!</tvar>, use <tvar name="2">[[Get Piping Hot Coffee Here!]]</tvar> and make it redirect to coffeehouse setup (please note: unlike above, what pops up when you point at the link, depending on your browser's support, is the text that is already shown).</translate>
<translate> It is convenient if the redirect is already there or will also be of use elsewhere. However, there are a few drawbacks.</translate>
- <translate> the popup does not show the destination page</translate>
- <translate> "[[<tvar name=1>Special:MyLanguage/Help:Related changes</tvar>|Related changes]]" shows the changes in the redirect page not the redirect target</translate>
- <translate> the redirect message that is shown on the target page slightly clutters it</translate>
<translate> Using a piped link and a redirect together, it is possible to provide information in the hover box that is not the name of the linked page, for example, the value of a unit in terms of other units.</translate> <translate> In that case, it is possible to make a page whose page name is the information that you'd like in the link title, and which redirects to the page with a more appropriate name.</translate> <translate> For example, the page w:30.48 cm redirects to w:Foot (unit).</translate>
<translate>
Pipe trick[edit]
If the part after the <tvar name=2>|</tvar> in a piped link is left empty, it is to an abbreviated form of the page name on the left, based on the following rules:
</translate>
- <translate> Any word that is before the first colon (:), as well as the colon character itself, is removed.</translate> <translate> This word may or may not be a 'namespace' prefix (such as "Help:") or an 'interwiki' prefix (such as "commons:").</translate> <translate> If the name of the page is preceded by a colon (:), "first" refers to "first after this".</translate>
- <translate> If there is some text in the parentheses at the end, then it will be removed.</translate>
- <translate> If there are no parentheses, but there is a comma (,) character, the comma and everything after it is removed.</translate>
- <translate> Note that this does not work for sections/anchors as <tvar name="1">
[[Help:Piped_link#Pipe_trick|]]</tvar> outputs <tvar name="2">[[Help:Piped_link#Pipe_trick|]].</tvar></translate>
<translate>
Similar to using the three or four tildes when signing on Talk pages, and using 'subst', in a preview, the result shows up in the preview itself, but the conversion in the edit box is not shown yet. Click on the <tvar name=1></tvar> option to see the change in the wikitext.
Examples[edit]
</translate>
- <translate> <tvar name=1>
[[Help:Template|]]</tvar> is converted to <tvar name=2>[[Help:Template|Template]]</tvar>, which is shown as <tvar name=3>Template</tvar></translate> - <translate> <tvar name="1">
[[Music: My life|]]</tvar> is converted to <tvar name="2">[[Music: My life| My life]]</tvar>, which is shown as <tvar name="3"> My life</tvar> - although "Music:" itself is not a namespace (therefore the space after the colon character is not automatically removed), however, the shortcut works anyway</translate> - <translate> <tvar name="1">
[[w:en:Pipe (computing)|]]</tvar> is converted to <tvar name="2">[[w:en:Pipe (computing)|en:Pipe]]</tvar>, which is shown as <tvar name="3">en:Pipe</tvar>.</translate> - <translate> <tvar name="1">
[[commons:Boston, Massachusetts|]]</tvar> is converted to <tvar name="2">[[commons:Boston, Massachusetts|Boston]]</tvar>, which is shown as <tvar name="3">Boston</tvar>.</translate> - <translate> <tvar name="1">
[[w:}|]]</tvar> does not give <tvar name="2">[[w:}|}]]</tvar>, and calling the template with a value of parameter 1 gives a working link, but in the case of substitution only.</translate> - <translate> <tvar name="1">
[[w:en:|]]</tvar> does not give <tvar name="2">[[w:en:|en:]]</tvar> and <tvar name="3">[[m:|]]</tvar> does not give <tvar name="4">[[m:|]]</tvar></translate> - <translate> <tvar name="1">
[[Wikipedia:Village pump (technical)#Pipe trick|]]</tvar> is not converted, so it does not give a working link.</translate>
| <translate> This wikitext</translate> | <translate> Produces</translate> |
|
<syntaxhighlight lang="wikitext">
</syntaxhighlight> |
* a * project:a * project:a * project:a * de:project:a * project:a * project:a * project:a * [[wikisource:project:a (b)#c|]] * en: en: * m: m: |
<translate>
Category tag[edit]
Since the sortkey syntax of the category is similar to a piped link, the pipe trick also works for category tags, even though technically, it is not useful there.
Limitation[edit]
</translate>
- <translate> <tvar name="1">[[Help:Lk|]]</tvar> using <tvar name="2">template:tc</tvar> is not converted, so the result is rendered as <tvar name="3">Lk</tvar> which is not as a working link.</translate> <translate> This is because like substitution, the pipe trick expansion occurs before ordinary expansion of the templates, etc.</translate> <translate> The pipe trick does not work if the linked page includes invalid characters.</translate> <translate> Therefore, while ordinarily the acceptability of the target page name is assessed after template expansion, the pipe trick expansion judges it before that.</translate> <translate> The braces are therefore considered invalid characters in the page name.</translate> <translate> Instead, a template can be used like <tvar name="1">template:pipe trick</tvar>: <tvar name="2">k}}</tvar> which renders as <tvar name="3">k}}</tvar>.</translate>
<translate>
Inverse pipe trick[edit]
On page "<tvar name="1">A (c)</tvar>", <tvar name="2">[[|b]]</tvar> is converted to <tvar name="3">[[b (c)|b]]</tvar> automatically.
Similarly, on page "<tvar name="1">A, c</tvar>", <tvar name="2">[[|b]]</tvar> is converted to <tvar name="3">[[b, c|b]]</tvar> automatically.
Anchors[edit]
Linking to an anchor[edit]
</translate>
<translate> Links in the format <tvar name=1>[[#anchor_name]]</tvar> will direct to the first matching anchor on the page, typically corresponding to the first identical section heading.</translate>
<translate> You can add an <tvar name=1>[[#anchor_name]]</tvar> to a link, directing it to the first matching section heading (or anchor) on the named page:</translate>
[[Help:Editing#Advanced editing]]
https://www.mediawiki.org/wiki/Help:Editing#Advanced_editing
<translate>
Using an automatic anchor[edit]
</translate> <translate> Section headings serve as anchors, using the heading text as the anchor name.</translate> <translate> If there are multiple sections with identical headings, each subsequent occurrence is appended with <tvar name=1>"_2", "_3"</tvar>, etc.</translate>
<translate> The anchor <tvar name=1>#toc</tvar> links to the page's table of contents (TOC), except when there's a section already titled <tvar name=2>"toc"</tvar>.
A manual anchor[edit]
</translate> <translate> Manually-set anchors are beneficial for linking to "unlinkable" elements such as tables (titles or cells) or sections of plain text.</translate> <translate> For instance, in the [[<tvar name=1>#External links to internal pages</tvar>|External links to internal pages]] section above, although the column text "Description" resembles a (minor) heading, it is not.</translate>
<translate> There are several methods to set an anchor at any position:</translate>
- <translate> The "anchor" [[<tvar name=1>help:Template</tvar>|template]], if it exists on your wiki, specified as <tvar name=2></tvar>, offers a standardized method to create anchor points.</translate> <translate> Place the template where you want, using the syntax <tvar name=2></tvar>.</translate> <translate> For instance, is placed in the "Description" column of the table below the "External links to internal pages" section.</translate> <translate> Clicking on <tvar name=1>#Description</tvar> links to that anchor point created on the table.</translate> <translate> The anchor is only visible via the source code.</translate>
- <translate> Use the generic anchor tag <tvar name=1>
<span id="anchor_name">some text</span></tvar> with optional text for visible anchors.</translate> <translate> For hidden anchors, omit the text.</translate> <translate> To point to the anchor use <tvar name=1>[[#anchor_name]]</tvar>.</translate> - <translate> Avoid using manual HTML headings like <tvar name=1>
<h2>Editing Instructions</h2></tvar>.</translate> <translate> This text serves as an <tvar name=1>anchor_name</tvar>.</translate> - <translate> In certain instances, adding an ID attribute similar to HTML within a Wiki-element is necessary.</translate> <translate> Take, for instance, the table mentioned earlier, titled [[<tvar name=1>#External links to internal pages</tvar>|External links to internal pages]]:</translate>
border="1" class="wikitable" id="You type"
- <translate> A top of a page can be accessed using the reserved term <tvar name=1>
[[#top]]</tvar>.</translate>
<translate> See also [[<tvar name=1>Special:MyLanguage/Help:Section#Linking sections using an arbitrary id</tvar>|Help:Section#Linking sections using an arbitrary ID]].
Using Linksearch anchors[edit]
As mentioned above, if external link style is used, e.g. <tvar name=1>[6]</tvar>, we can use <tvar name=2>Special:Linksearch</tvar>: <tvar name=3>[7]</tvar>. </translate>
<translate> When using Linksearch, it's helpful to add leading zeros to numerical anchor names to prevent unintended matches.</translate> <translate> For example, instead of searching for "1", use "01" to avoid including "10".</translate> <translate> This practice is seen in Template:Current events header.</translate> <translate> Similarly, if there are anchors like "a" and "ab", using "_a" can distinguish them in search results.</translate>
<translate>
Using <tvar name=1>anchorencode</tvar>[edit]
</translate>
<translate> The <tvar name=1>#anchorencode</tvar> parser function encodes input to use as an anchor.</translate>
<translate> For example, to external link to <tvar name=1>#Using linksearch anchors</tvar> above, you would use <tvar name=2>https://www.mediawiki.org/wiki/Help:Links#</tvar>, which resolves to <tvar name=3>https://www.mediawiki.org/wiki/Help:Links#</tvar></translate>
<translate>
Subpage feature[edit]
</translate> <translate> MediaWiki has a [[<tvar name=1>mw:Special:MyLanguage/Help:subpages</tvar>|subpage]] feature that may or may not be active depending on the project and namespace.</translate> <translate> If it's activated, the following rules apply; otherwise, "A/b" is simply a standalone page with that name.</translate>
<translate> A page's tree structure is formed using forward slashes in page names: A/b is considered a subpage of A, making A the parent of A/b; additionally, A/b/c is a subpage of A/b; meanwhile, A/a, A/b, and A/c are categorized as sibling pages.</translate>
<translate> The subpage body automatically displays links to all parent pages without needing specific wikitext.</translate> <translate> These links appear even if the parent page doesn't exist.</translate> <translate> However, if any ancestor page in the sequence is missing, the chain of links will stop before that point.</translate> <translate> Additionally, the capitalization of letters after the forward slash in the page name matters, meaning "<tvar name=1>/subpage</tvar>" and "<tvar name=2>/Subpage</tvar>" refer to different pages.</translate>
<translate> The functions, [[<tvar name=1>Special:MyLanguage/Help:What links here</tvar>|What links here]] and [[<tvar name=2>Special:MyLanguage/Help:Related changes</tvar>|Help:Related changes]] do not consider these automatically generated links.
When the subpage feature is enabled within a namespace, any forward slash in a page's name automatically creates a subpage structure, regardless of whether it was intended or not.
You can find a list of subpages using <tvar name=1>Special:PrefixIndex</tvar>.
Using variables[edit]
When utilizing the subpage feature within namespace A on page A:B/c/d, <tvar name=1></tvar> shows B/c while <tvar name=2></tvar> shows d.
Using relative links[edit]
Within a subpage hierarchy, you can utilize the following relative links: </translate>
- <translate> <tvar name=1>[[../]]</tvar> links to the parent page of the current subpage.</translate> <translate> For example, on page A/b, it takes you to page A, and on page A/b/c, it directs you to page A/b.</translate>
- <translate> <tvar name=1>[[../../]]</tvar> links to the grandparent page of the current subpage.</translate> <translate> For example, on page A/b/c, it points to page A.</translate>
- <translate> <tvar name=1>[[../s]]</tvar> links to a sibling page of the current subpage.</translate> <translate> For example, on page A/b, it leads to page A/s.</translate>
- <translate> <tvar name=1>[[../../s]]</tvar> links to an "uncle" page of the current subpage.</translate> <translate> For example, on page A/b/c, it points to page A/s.</translate>
- <translate> <tvar name=1>[[/s]]</tvar> links direct to a subpage.</translate> <translate> On page A, it functions similarly to <tvar name=1>[[A/s]]</tvar>.</translate> <translate> However, linking from a namespace with an enabled subpage feature to a main namespace page starting with <tvar name=1>"/"</tvar> requires a workaround: adding a colon before the page name.</translate>
<translate> Relative links remain functional even when all pages within a hierarchy are renamed to reflect a change in the root's name, even if the root becomes a child of a new parent.</translate>
<translate> Users with the appropriate permissions, such as administrators and those with the <tvar name=1>move-subpages</tvar> right, have the option to move both the main page and its subpages during a renaming process.</translate>
<translate> Learn more about subpages at Subpages.</translate> <translate> See examples at [[<tvar name=1>Special:MyLanguage/Help:Links/example</tvar>|Help:Links/example]] and [[<tvar name=2>Special:MyLanguage/Help:Links/example/example2</tvar>|Help:Links/example/example2]]</translate>
<translate>
Subpage activation[edit]
This feature is only enabled in namespaces specified in the <tvar name=1></tvar> configuration setting, either its [[<tvar name=2>Special:MyLanguage/Manual:$wgNamespacesWithSubpages#Default value</tvar>|default namespaces]], or any additional namespaces set in <tvar name=4></tvar>
Character conversion[edit]
</translate>
<translate> The guidelines outlined in [[<tvar name=1>Special:MyLanguage/Manual:Page naming</tvar>|Manual:Page naming]] state that in wiki and interwiki links, conversions are made to [[<tvar name=2>Special:MyLanguage/Help:Special characters</tvar>|non-literal characters]] automatically.</translate>
<translate> For example,"<tvar name=1>[[Manual:Page%20naming]]</tvar>" will display as "<tvar name=2>Manual:Page naming</tvar>".</translate>
<translate> Conversely, external links operate oppositely; literal characters are transformed into non-literal characters.</translate>
<translate> For example, browsers typically convert "<tvar name=1>.../wiki/!</tvar>" to "<tvar name=2>.../wiki/%21</tvar>".</translate>
<translate> Applying a code like <tvar name=1>%70</tvar> to a redirect deactivates it, even though the link remains accessible from the redirect page.</translate> <translate> To ensure a successful redirect, the redirect page displays the canonical form of the target, unlike the preview page which shows the link in its regular format.</translate>
<translate>
Miscellaneous[edit]
Some additional effects of links[edit]
</translate>
- <translate> [[<tvar name=1>Special:MyLanguage/Help:What links here</tvar>|Backlink]]s, <tvar name=2></tvar></translate>
- <translate> When you include a space after the pipe symbol (<tvar name=1>[[main Page| ]]</tvar>), the outcome can vary depending on the browser.</translate> <translate> In some cases, it might only display a space (" "), without creating a clickable link.</translate> <translate> However, it's still recognized as a link by the <tvar name=1>
</tvar> feature.</translate>
<translate>
"Hover box" on links[edit]
</translate>
<translate> In certain web browsers, when you place the cursor over a link, a tooltip may appear, displaying the content of the link's HTML title attribute.</translate>
<translate> MediaWiki assigns different values to this attribute depending on the type of link: for internal wikilinks, it displays the page name and <tvar name=1></tvar>, if the page does not exist; for interwiki links, it displays the page name with a prefix; and for external links, it displays the URL.</translate>
<translate> The browser might also display similar information in its status bar, possibly showing which section it belongs to.</translate>
<translate> Using a <tvar name=1></tvar>, even if it isn't clicked, can help clarify acronyms (like displaying "[[<tvar name=2>m:neutral point of view</tvar>|neutral point of view]]" as <tvar name=3>NPOV</tvar>) or adding annotations.</translate>
<translate> Hover boxes can also be created without links, you can customize the hover box content using markup like <tvar name=1>[[Link title|<span title="hoverbox">Display text</span>]]</tvar>.</translate>
<translate> You cannot include a title attribute directly within the href element for external links.</translate>
<translate> Nevertheless, you can achieve a similar outcome by using a span element instead, like this:</translate>
[http://www.example.com <span title="hover text on external link">www.example.com web site</span>] :
www.example.com web site
<translate>
Retrieving links from a page[edit]
</translate> <translate> The [[<tvar name=1>Special:MyLanguage/API:Main page</tvar>|MediaWiki API]] allows users to retrieve all links from a page.</translate> <translate> For example, you can utilize the API query called [[<tvar name=1>Special:MyLanguage/API:Links</tvar>|API:Links]] to achieve this.</translate>
<translate>
Linking to a page from an image[edit]
</translate> <translate> You can utilize images to direct users to other pages.</translate> <translate> For further details, refer to the guidance on [[<tvar name=1>Special:MyLanguage/Manual:Linked images</tvar>|utilizing an image to link to a specific page]] in the help section.</translate>
<translate>
Limits[edit]
An internal wiki link is limited by maximum [[<tvar name=2>Special:MyLanguage/Manual:page title</tvar>|page title]] size.
See also[edit]
</translate>
- <translate> (and the next section)</translate>
- <translate> Red Link</translate>
- <translate> Wikipedia:Canonicalization</translate>
- Special:Mostlinked – <translate> Displays the number of links.</translate>
- Special:Lonelypages – <translate> A list of pages not linked to any page.</translate>
Sample content adapted from mediawikiwiki:Help:Links on mediawiki.org, licensed under CC BY-SA 4.0.