Difference between revisions of "Help:Links"
m (Fix typo introduced in revision 2588974) |
m (1 revision imported) |
(No difference)
|
Latest revision as of 07:20, 27 November 2017
<languages/> Template:TNT <translate> There are five types of hypertext links in MediaWiki:
- [[<tvar|internal>#Internal links</>|Internal links]] to other pages in the same wiki (commonly called "wikilinks")
- [[<tvar|external>#External links</>|External links]] to pages at other websites
- [[<tvar|external2>#External links to internal pages</>|External links to internal pages]] in the same wiki
- [[<tvar|interwiki>#Interwiki links</>|Interwiki links]] to other websites using special prefixes registered in advance
- [[<tvar|interlang>#Interlanguage links</>|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|h-cat>Special:MyLanguage/Help:Categories</>|category links]] and [[<tvar|h-img>Special:MyLanguage/Help:Images</>|file links]], which are used to place pages into categories and display images or other media files, respectively. </translate>
Contents
{{safesubst:#invoke:anchor|main}} <translate>
Internal links[edit]
To Template:Ll a so-called internal link to a page on the same wiki (a "wikilink"), use double square brackets wiki markup, [[like this]]
. When you preview or save your changes, you will see a link that can be followed to the target page. 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 [[like this]]
link is actually rendered like this). Note that the colors could be different if the color scheme of the wiki has been changed from the default. Following such a "redlink" to a missing page (whether or not it is actually red) will usually enable the user to create the page.
To markup any arbitrary string of text (not necessarily a page title) as a link, use a "vertical bar" or "pipe" character, like this: [[Help:Categories|category links]]
results in the link category links.
The first letter of the link target is usually case-insensitive (unless the wiki is configured otherwise), meaning links can be capitalized or not (so How to contribute and how to contribute are equivalent). However, the case of every subsequent letter must match the target page exactly (so How to contribute and How To Contribute are not equivalent). 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 is typically frowned upon since they will be visible in the page text (but this can be prevented by using a "pipe").
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 [[Help:Links]]
gives the result Help:Links). 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.
MediaWiki uses the Template:Ll to keep track of internal wikilinks. </translate>
<translate> Description</translate> | <translate> You type</translate> | <translate> You get</translate> |
---|---|---|
<translate> Internal link</translate> | [[Main Page]] [[Help:Contents]] [[Extension:DynamicPageList (Wikimedia)]] |
|
<translate> Piped link</translate> | [[Help:Editing pages|editing help]] [[Help:Editing pages#Preview|previewing]] <translate> See also [[<tvar|meta>meta:Special:MyLanguage/Help:Piped link</>|meta:Help:Piped link]]. The second example links to a section (or anchor) within the target page.</translate> |
|
Pipe trick | [[Manual:Extensions|]] [[User:John Doe|]] [[Extension:DynamicPageList (Wikimedia)|]] [[Extension:DynamicPageList (third-party)|]] <translate> The pipe trick involves less typing for editors, but is potentially confusing to readers, as seen in these DynamicPageList examples.</translate> |
|
<translate> Word-ending links</translate> | [[Help]]s [[Help]]ing [[Help]]ers [[Help]]almostanylettersyoulikehere [[Help]]BUTnotalways <translate> Follows so-called "linktrail rules" [[<tvar|loc>Special:MyLanguage/Localisation</>|localised]] per [[<tvar|msgxx>Special:MyLanguage/MessagesXx.php</>|each language]].</translate> |
Helpalmostanylettersyoulikehere HelpBUTnotalways |
<translate> Avoiding word-ending links</translate> | [[Help]]<nowiki />ful advice [[wikipedia:GNU General Public License|GPL]]<nowiki />v3 |
Helpful advice GPLv3 |
<translate> Redirect</translate> | #REDIRECT [[Main Page]] <translate> Should be the first and only line on the page. See [[<tvar|redirects>Special:MyLanguage/Help:Redirects</>|Help:Redirects]].</translate> |
File:Redirect arrow without text (cropped).svg Main Page |
<translate> Link to an anchor on the same page</translate> | [[#See also]] <translate> Anchors are provided automatically on [[<tvar|formatting>Special:MyLanguage/Help:Formatting</>|section headings]] and to the top of the page.</translate> |
#See also |
<translate> Piped link to an anchor on the same page</translate> | [[#See also|different text]] |
different text |
<translate> Setting an anchor for incoming links</translate> | <div id="Unique anchor name 1">optional text</div> <span id="Unique anchor name 2">optional text</span> <translate>
Rendered block-level and inline, respectively.
Doing this would allow for |
<div id="<translate> Unique anchor name 1</translate>"><translate> optional text</translate></div> <span id="<translate> Unique anchor name 2</translate>"><translate> optional text</translate></span> |
<translate> Setting an anchor in a section heading</translate> | ==<span id="Alternate Section Title"></span>Section heading== <translate> Note the placement. This must be a "span" tag, not a "div". (Such anchors allow sections to be retitled without breaking incoming links.)</translate> |
|
<translate> Link to an anchor at another page</translate> | [[Help:Images#Supported media types for images]] |
Help:Images#Supported media types for images |
<translate> Link to the current page's talk page</translate> | [[{{TALKPAGENAME}}|Discussion]] <translate> See also [[<tvar|page-names>Special:MyLanguage/Help:Magic_words#Page_names</>|Help:Magic words#Page names]]</translate> |
Discussion |
<translate> Link to a subpage</translate> | [[/example]] <translate>
Shortcut for |
/example |
<translate> Link to a subpage without the leading slash</translate> | [[/example/]] <translate> Shortcut for <tvar|code> |
example |
<translate> Visible link to a category page</translate> | [[:Category:Help]] <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. See also [[<tvar|cat>Special:MyLanguage/Help:Categories</>|Help:Categories]].</translate> |
Category:Help |
<translate> Visible link to an image or media file</translate> | [[:File:example.jpg]] [[:File:example.jpg|this example]] [[media:example.jpg]] <translate> Without the leading colon on the "File:" examples, the images would actually be displayed. See also <tvar|h-img>Template:Ll</>. Note that using the "media:" prefix links directly to the uploaded file.</translate> |
|
<translate> Link to a page specific to each reader (user page, etc.)</translate> | [[Special:MyPage]] [[Special:MyTalk]] [[Special:Preferences]] |
|
<translate> Internal link to a specific revision</translate> | [[Special:PermanentLink/2393992]] <translate> Revision numbers can be found in each page's [[<tvar|h-hist>Special:MyLanguage/Help:History</>|edit history]]. (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> | [[Special:Diff/2393992]] [[Special:Diff/2390639/2393992]] <translate> The default (in the first example above) is to show the changes from the previous revision. See also the comments in the previous item.</translate> |
{{safesubst:#invoke:anchor|main}} <translate>
External links[edit]
To [[<tvar|h-edit>Special:MyLanguage/Help:Editing pages</>|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). When you save or preview the page, you will see a link rendered slightly differently than an internal wikilink. 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. 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|1> |
https://mediawiki.org |
<translate>Avoiding auto-linked URLs</translate> | <nowiki>https://mediawiki.org</nowiki> |
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|code1>HTTP</> or <tvar|code2>HTTPS</> depending on the protocol of the page currently being viewed (which could be different for different users).
This is only supported inside of square brackets <tvar|code3> |
|
<translate> External link to the current server</translate> | https://{{SERVERNAME}}/pagename |
https://www.iotforindia.org/pagename |
<translate> External link to other host passing the pagename</translate> | https://google.com/search?q={{PAGENAMEE}} <translate> See also: [[<tvar|encoded>Special:MyLanguage/Help:Magic_words#URL_encoded_page_names</>|URL encoded page names]], [[<tvar|PAGENAMEE>Special:MyLanguage/Manual:PAGENAMEE encoding</>|PAGENAMEE encoding]]</translate> |
https://google.com/search?q=Links |
<translate> Mailto link</translate> | [mailto:info@example.org email me] |
email me |
<translate> Mailto named with subject line and body</translate> | [mailto:info@example.org?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|UrlProtocols>Template:Ll</>.</translate> <translate> (This example is not enabled on Mediawiki.org)</translate> |
[skype:echo123 call me] |
<translate> External links with file-type icons</translate> | [https://en.wikipedia.org/wiki/.avi video] [https://en.wikipedia.org/wiki/.ogg sound] [https://en.wikipedia.org/wiki/.pdf document] <translate> See [[<tvar|external3>#External link icons</>|External link icons]] for currently supported icons and extensions. Note that this wiki is not set up to use such icons.</translate> |
{{safesubst:#invoke:anchor|main}} <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 Edit this page] [{{fullurl:{{FULLPAGENAME}}|action=edit}} Edit this page] <translate> See also [[<tvar|url-data>Special:MyLanguage/Help:Magic_words#URL_data</>|Help:Magic_words#URL_data]] and [[<tvar|external>#External links</>|External links]] above.</translate> |
|
<translate> External link to the current page's edit page, and styled to look like an internal link</translate> | <span class="plainlinks">[https://www.mediawiki.org/w/index.php?title=Help:Links&action=edit Edit this page]</span> <translate> The 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> |
Edit this page |
{{safesubst:#invoke:anchor|main}} <translate>
External link icons[edit]
</translate>
Some MediaWiki installations are set up to use special icons to denote external links to specific file types or using specific protocols. None of these special icons are enabled here on MediaWiki.org, but we present them here for the sake of completeness.
<translate> Test link</translate> | <translate> Icon</translate> | <translate> Trigger</translate> |
---|---|---|
[2] | File:Icon External Link.png | http:// , gopher:// , [//]
|
[3] | File:Lock icon blue.gif | https://
|
[4] | File:Icon External Link E-Mail.png | mailto:
|
[5] | File:Icon External Link Newsgroups.png | news://
|
[6] | File:Icon External Link FTP.png | ftp://
|
[7] | File:Icon External Link IRC.png | irc://
|
[8] | File:Icon External Link MP3.png | .ogg , .mid , .midi , .mp3 , .wav , .wma
|
[9] | File:Icon External Link Video.png | .ogm , .avi , .mpeg , .mpg
|
[10] | File:Icons-mini-file acrobat.gif | .pdf , .pdf# , .pdf?
|
{{safesubst:#invoke:anchor|main}} <translate>
Interwiki links[edit]
Interwiki links are internal-style links to other websites (which do not have to be wikis, despite the name). For example, you can link to the article http://en.wikipedia.org/wiki/Sunflower by typing [[wikipedia:Sunflower]]
or, on this wiki, the shorter [[w:Sunflower]]
. Both will result in a link wikipedia:Sunflower. This works because by default MediaWiki configures wikipedia:
as an "interwiki prefix" that turns into http://en.wikipedia.org/wiki/ when used inside [[ ]]. (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.
Similar to internal page links, you can create piped links, 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 [http://en.wikipedia.org/wiki/Sunflower big yellow flower]
.
More details are at [[<tvar|interwiki>Special:MyLanguage/Manual:Interwiki</>|Manual:Interwiki]] and m:Help:Interwiki linking. Your wiki may have a Special:Interwiki page listing the interwiki prefixes it supports; Template:Git file. You can edit the [[<tvar|interwiki-table>Special:MyLanguage/Manual:Interwiki table</>|Manual:Interwiki table]] on your site. </translate>
{{safesubst:#invoke:anchor|main}} <translate>
Interlanguage links[edit]
If your wiki has other language versions, you may find “interlanguage links” in the [[<tvar|sidebar>Special:MyLanguage/Help:Navigation#Sidebar</>|sidebar]], just below [[<tvar|toolbox>Special:MyLanguage/Help:Navigation#Toolbox</>|toolbox]] in a section titled “in other languages.”
In wiki markup an interlanguage link looks very much like an interwiki link, but behaves similarly to a category link in that it is rendered in a special way. While category links appear in a special list at the bottom of the page (usually), interlanguage links appear in a special list in the sidebar of the page (or elsewhere, depending on the wiki's configuration and the skin used).
The purpose of interlanguage links is to link pages on the same topics in different languages. To create an interlanguage link, type [[language prefix:page name]]
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 "Edit links" in the languages section of Wikipedia-language versions.</translate>
<translate>
But it can be used across all name spaces, including 'User:' to point to ones other profiles in other languages.
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|meta>m:Help:Interwiki linking#Interlanguage links</>]]. </translate> {{safesubst:#invoke:anchor|main}} <translate>
Limits[edit]
An internal wiki link is limited by maximum page title size.
See also[edit]
</translate>
[[Category:Help{{#translation:}}|Links]]
[[Category:Link{{#translation:}}|Links]]