Difference between revisions of "Help:Interwiki linking"

From SacredWiki
Jump to navigation Jump to search
 
m (1 revision: Updating our Help Pages)
 
(3 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{PD Help Page}}
+
{{H:h|editor toc}}
'''Interwiki links''' are links to pages of other projects, using a prefixed internal link style.
 
  
Interwiki links make it possible, to link to pages of (e.g.) Wikipedia, Wikibooks, Wikinews etc. or to your wiki-project in different languages (see [[Manual:Wiki family]]).  
+
By adding a prefix to another [[Wikimedia projects|project]], internal link style ("prefixed internal link style") can be used to [[Help:Link|link]] to a page of another project. A system of shorthand link labels are used to refer to different projects, in the context of interproject linking, as seen within the actual source text. For example, <code>en:</code> refers to the English Wikipedia. This is seen in <code><nowiki>[[en:Apple]]</nowiki></code>, which produces [[en:Apple]], a link to the English Wikipedia article on "Apple".
  
A link like <code><nowiki>[[Wikipedia:Main Page]]</nowiki></code> will appear like this: [[Wikipedia:Main Page]] and redirect you to Wikipedia's Main Page.
+
This is called [[w:en:InterWiki|interwiki]]. For each project, an [[m:Interwiki map|interwiki map]] (a list of target projects with their prefixes) is specified ([http://svn.wikimedia.org/viewvc/mediawiki/trunk/phase3/maintenance/interwiki.sql?view=markup example]). These target projects need not use MediaWiki and need not even be a wiki.
  
For setting up interwiki links, you might need to edit the Database.
+
==Interwiki linking from and within Wikimedia==
 +
Within [[m:Wikimedia|Wikimedia]], for the purpose of {{mlww|interlanguage links||interlanguage links}} (see below), the project families are Wikipedia, Wiktionary, Wikiquote, Wikibooks and Wikisource. Thus, this applies for a link like en:, de:, etc., from a Wikipedia to another one, from a Wiktionary to another one, from a Wikiquote to another one, from a Wikibooks to another one or from a Wikisource to another one.
  
==Interwiki links to other projects==
+
The interlanguage link feature works on Wikimedia Commons and produces links to the Wikipedias. This is not reciprocal, a link from a Wikipedia to Commons is an in-page link.
===Default===
+
 
Several Wikimedia-Projects (and others) are ready for interwiki linking by default, so you can use them without editing your database. However, the mother of all Wikimedia-projects &mdash; the Wikipedia itself &mdash; is for some reason missing.
+
===Project titles and shortcuts===
{| {{prettytable}}
+
{| class="wikitable sortable" style="margin-bottom:0"
|{{Hl3}} align="center"|'''prefix'''
+
! Project !! Long form !! Shortcut
|{{Hl3}} align="center"|'''direction'''
+
|-
|{{Hl3}} align="center"|'''usage example'''
+
| [[Wikipedia]]
 +
| <code>[[[[wikipedia:]]]]</code>
 +
| <code>[[[[w:]]]]</code>
 +
|-
 +
| [[Wiktionary]]
 +
| <code>[[[[wiktionary:]]]]</code>
 +
| <code>[[[[wikt:]]]]</code>
 
|-
 
|-
|commons
+
| [[Wikinews]]
|<nowiki>http://commons.wikimedia.org/wiki/</nowiki>
+
| <code>[[[[wikinews:]]]]</code>
|<code><nowiki>[[commons:MediaWiki]]</nowiki></code>
+
| <code>[[[[n:]]]]</code>
 
|-
 
|-
|mediazilla
+
| [[Wikibooks]]
|<nowiki>http://bugzilla.wikimedia.org/</nowiki>
+
| <code>[[[[wikibooks:]]]]</code>
|<code><nowiki>[[mediazilla:1209]]</nowiki></code>
+
| <code>[[[[b:]]]]</code>
 
|-
 
|-
|meta
+
| [[Wikiquote]]
|<nowiki>http://meta.wikimedia.org/wiki/</nowiki>
+
| <code>[[[[wikiquote:]]]]</code>
|<code><nowiki>[[meta:Main Page]]</nowiki></code>
+
| <code>[[[[q:]]]]</code>
 
|-
 
|-
|mw
+
| [[Wikisource]]
|<nowiki>http://www.mediawiki.org/wiki/</nowiki>
+
| <code>[[[[wikisource:]]]]</code>
|<code><nowiki>[[mw:Help:Contents]]</nowiki></code>
+
| <code>[[[[s:]]]]</code>
 
|-
 
|-
|wikibooks
+
| [[Wikispecies]]
|<nowiki>http://en.wikibooks.org/wiki/</nowiki>
+
| <code>[[[[wikispecies:]]]]</code>
|<code><nowiki>[[wikibooks:Main Page]]</nowiki></code>
+
| <code>[[[[species:]]]]</code>
 
|-
 
|-
|wikimedia
+
| [[Wikiversity]]
|<nowiki>http://wikimediafoundation.org/wiki/</nowiki>
+
| <code>[[[[wikiversity:]]]]</code>
|<code><nowiki>[[wikimedia:Main Page]]</nowiki></code>
+
| <code>[[[[v:]]]]</code>
 
|-
 
|-
|wikinews
+
| [[Wikivoyage]]
|<nowiki>http://en.wikinews.org/wiki/</nowiki>
+
| <code>[[[[wikivoyage:]]]]</code>
|<code><nowiki>[[wikinews:Main Page]]</nowiki></code>
+
| <code>[[[[voy:]]]]</code>
 
|-
 
|-
|wikiquote
+
| [[Wikimedia Foundation]]
|<nowiki>http://en.wikiquote.org/wiki/</nowiki>
+
| <code>[[[[wikimedia:]]]]<br>[[[[foundation:]]]]</code>
|<code><nowiki>[[wikiquote:Main Page]]</nowiki></code>
+
| <code>[[[[wmf:]]]]</code>
 
|-
 
|-
|wikisource
+
| [[Wikimedia affiliation models|Wikimedia affiliates]]
|<nowiki>http://en.wikisource.org/wiki/</nowiki>
+
| <code><nowiki>[[affiliate:]]</nowiki></code>
|<code><nowiki>[[wikisource:Main Page]]</nowiki></code>
+
| <code></code>
 
|-
 
|-
|wikispecies
+
| [[Wikimedia Commons]]
|<nowiki>http://species.wikimedia.org/wiki/</nowiki>
+
| <code>[[[[commons:]]]]</code>
|<code><nowiki>[[wikispecies:Main Page]]</nowiki></code>
+
| <code></code>
 
|-
 
|-
|wiktionary
+
| [[Meta:About|Wikimedia Meta-Wiki]]
|<nowiki>http://en.wiktionary.org/wiki/</nowiki>
+
| <code>[[[[metawikipedia:]]]]<br />[[meta:]]</code>
|<code> <nowiki>[[wiktionary:Main Page]]</nowiki></code>
+
| <code>[[[[m:]]]]</code>
 
|-
 
|-
 +
| [[Wikimedia Incubator]]
 +
| <code>[[[[incubator:]]]]</code>
 +
| <code></code>
 +
|-
 +
| [[MediaWiki]]
 +
| <code></code>
 +
| <code>[[[[mw:]]]]</code>
 +
|-
 +
| [[Bugzilla|MediaZilla]] / [[Bugzilla]]
 +
| <code>[[[[mediazilla:]]]]<br />[[[[bugzilla:]]]]</code>
 +
| <code></code>
 +
|-
 +
| [[m:Testwiki|Testwiki]]
 +
| <code>[[[[testwiki:]]]]</code>
 +
| <code></code>
 +
|-
 +
| [[WikiTech|Wikitech]]
 +
| <code>[[[[wikitech:]]]]</code>
 +
| <code></code>
 +
|-
 +
| [[Wikidata]]
 +
| <code>[[[[wikidata:]]]]</code>
 +
| <code>[[[[d:]]]]</code>
 
|}
 
|}
  
Note: In some installations none of these is pre-installed. Try <code><nowiki>[[metawikipedia:Main Page]]</nowiki></code> in this case.
+
<span style="font-size:90%">* Other Wikimedia prefixes: [[betawikiversity:]], [[download:]], [[dbdump:]], [[mail:]], [[mailarchive:]], [[otrs:]], [[OTRSwiki:]], [[quality:]], [[spcom:]], [[tools:]], [[tswiki:]], [[svn:]], [[rev:]], [[wmania:]], [[wm2005:]], [[wm2006:]], [[wm2007:]], [[wm2008:]], [[wm2009:]], [[wm2010:]], [[wm2011:]], [[wm2012:]].</span>
 +
<br />
 +
 
 +
Some of the '''long forms''' don't work as expected within the same project; for example <tt><nowiki>[[meta:]]</nowiki></tt> doesn't work on Meta, while <tt><nowiki>[[metawikipedia:]]</nowiki></tt> does. This depends on the configuration of the wiki and where the names are stored (see also next paragraph). The '''shortcuts''' work everywhere. ''(That is the intention; currently (16-Jan-2007), it does not work on all projects.)''
 +
 
 +
The [[m:Interwiki map|interwiki map]] on Meta lists many prefixes, among others, <tt><nowiki>[[wikipedia:]]</nowiki></tt> ([[wikipedia:]]) for the English Wikipedia, working from any Wiki supporting the Meta interwiki map, not only from MediaWiki wikis. Some prefixes work only with a page, for example: [[wikipediawikipedia:]] (fails) vs. [[wikipediawikipedia:Interwikimedia link]] (works). These prefixes are case insensitive.
 +
 
 +
One-letter prefixes (as a live check on the table): {{for|call=If interwiki link show||a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|q|r|s|t|u|v|w|x|y|z}}
 +
Those are not real shortcuts, just interwikis with different histories. Wikipedia, Wikiquote etc. point to the English versions and are also included in the standard MediaWiki interwiki table (IIRC); w, q, b, wikt etc. are used like interlanguage wikilinks to link to the sisterproject in the same language (so [[w:it:b:]] is equivalent to [[Wikibooks:it:]]).
 +
 
 +
Non-Wikimedia interwiki codes have a limitation, that they can only be used through a link. For example, the entry for "[[wikt:John|John]]" on Wiktionary, a Wikimedia project, can be accessed by <tt><nowiki>[[wikt:John]]</nowiki></tt> or http://meta.wikimedia.org/wiki/wikt:John. However, the latter method does not work for non-Wikimedia wikis. For example, the main page on the Mozilla Wiki can be accessed via <tt><nowiki>[[MozillaWiki:Main Page]]</nowiki></tt>, but http://meta.wikimedia.org/wiki/MozillaWiki:Main_Page results in an error.
 +
 
 +
===Interwiki links on other sites ===
 +
Other MediaWiki installations will support different interwiki prefixes.
 +
You may be able use the [[mw:API:Query_-_Meta#siteinfo_.2F_si|MediaWiki API]] to query for a site's available interwiki prefixes.
 +
Try replacing the <tt>index.php?''stuff''</tt> on the end of an edit or history URL with
 +
  api.php?action=query&meta=siteinfo&siprop=interwikimap
 +
 
 +
==Technical==
 +
A project's own namespace prefix cannot be reused as code for an external project. However, the prefix used for a target project may coincide with the prefix for a project namespace, within that project. As a result, to link to a page in that namespace, use the same prefix twice, for example: [[en:Wikisource:Wikisource:Scriptorium]].
 +
 
 +
For portability across projects, one may want to select a link code that leads to the same target from all projects, for example: [[MetaWikipedia:wikibooks:Main Page]]. The "superfluous" "MetaWikipedia:" prevents "wikibooks:" being interpreted as namespace prefix, when the code is used at wikibooks itself, while at Meta the "MetaWikipedia:" is ignored (it is not a namespace prefix and even at Meta itself, it is recognized as code for Meta). The codes above work from all projects; however, the [[Help:Link#Wikilinks|existence detection]] and the [[Help:Self link|self-link feature]] do not work on interwiki links.
 +
 
 +
===Prefixes===
 +
Interwiki links can use prefixes for the '''project''' and/or for the '''language'''. Without the prefix, links are local,
 +
for pages in the same project and the same language. If only a language is given, they go to a page in the same
 +
(or similar) project for the specified language:
 +
 
 +
<nowiki>[[:fr:]]</nowiki> [[:fr:]]
 +
<nowiki>[[:os:]]</nowiki> [[:os:]]
 +
 
 +
If only the project is specified, they typically go to the language of the source, see above. At most, two prefixes
 +
are needed for pages in any existing project and any supported language:
 +
 
 +
<nowiki>[[s:de:Hauptseite]]</nowiki> [[s:de:Hauptseite]]
 +
<nowiki>[[b:en:Main page]]</nowiki>&#160; [[b:en:Main page]]
 +
 
 +
In the case of more than one prefix, a page name has to be specified. For example, while [[w:]] and [[:en:]] from Meta lead to the English Wikipedia's main page, a bare <code><nowiki>[[w:en:]]</nowiki></code> does not work: [[w:en:]].
 +
 
 +
If the language is different, specifying it before the project can also work:
 +
 
 +
<nowiki>[[:de:q:Hauptseite]]</nowiki> [[:de:q:Hauptseite]]
 +
<nowiki>[[:en:n:Main page]]</nowiki>&#160; [[:en:n:Main page]]
 +
<nowiki>[[n:en:Main page]]</nowiki> &#160; [[n:en:Main page]]
 +
 
 +
The second example doesn't work from English Wikipedia <code>w:en:</code> pages, a project prefix before the language is better.
 +
 
 +
More than two prefixes are generally unnecessary, the following examples should work everywhere:
 +
 
 +
<nowiki>[[m:Help:Help]]</nowiki> [[m:Help:Help]]
 +
<nowiki>[[w:Interwiki]]</nowiki> [[w:Interwiki]]
 +
 
 +
Two prefixes can have unexpected effects, for example, from [[m:|Meta]], the following links end up on
 +
different pages:
 +
 
 +
<nowiki>[[m:en:About]]</nowiki>&#160; [[m:en:About]]
 +
<nowiki>[[:en:m:About]]</nowiki> [[:en:m:About]]
 +
<nowiki>[[m:About]]</nowiki> &#160; &#160; [[m:About]]
 +
 
 +
In the first case [[m:|Meta]] ignores the <code>m:</code>, because it is local and then, interprets
 +
<code>en:</code> as <code>w:en:</code>, the prefix for the [[w:en:About|English Wikipedia]]. In the second case, the leading <code>en:</code> goes to the English Wikipedia, where the following <code>m:</code> goes straight back to [[m:About|Meta]]. The second example doesn't work at all, from English Wikipedia <code>w:en:</code> pages, only the third example works everywhere.
 +
 
 +
In other words, multiple prefixes are evaluated left to right by the relevant Wikimedia servers (project and language). For projects without different languages, like [[m:|Meta]] (because Meta is
 +
multilingual by itself), language prefixes can be handled as shorthands for <code>w:</code> plus the specified language:
 +
 
 +
<nowiki>[[:pl:2006]]</nowiki> &#160; [[:pl:2006]]
 +
<nowiki>[[w:pl:2006]]</nowiki>&#160; [[w:pl:2006]]
 +
<nowiki>[[:pl:w:2006]]</nowiki> [[:pl:w:2006]]
 +
 
 +
From [[m:|Meta]], the first two links both arrive at the Polish 2006 page. The third arrives at the English [[w:|Wikipedia]], because that's how the server selected by <code>:pl:</code> interprets the second prefix <code>w:</code>.
 +
 
 +
For a portable link on that server, it would be a bad idea to use <code>w:</code>, but <code>:pl:</code> does the trick. To test that effect from [[m:|Meta]], the following links should go to the same page:
 +
 
 +
<nowiki>[[:ja:2006]]</nowiki> &#160;&#160; [[:ja:2006]]
 +
<nowiki>[[:ja:ja:2006]]</nowiki> [[:ja:ja:2006]]
 +
 
 +
A universal interwiki link, that is, one that works no matter from which Wikimedia wiki, can be written <nowiki>[[m:</nowiki>''project'':''language'':''page name'']] (e.g. [[m:b:nl:Wiskunde]]); this routes the parsing of the links via Meta ([[bugzilla:4285|bug 4285]]).
 +
 
 +
===Non-local interwikis===
 +
Technically, an interwiki [[mw:Manual:Interwiki table|defined as local]] is one which always "forwards" to the destination: such interwikis can always be concatenated. The examples above work because all those interwikis are local in all those wikis. Interwikis which are not local in the wiki where they're concatenated or used directly won't work.
 +
The following works:
 +
<nowiki>[[MeatBall:AssumeGoodFaith]]</nowiki> &#160;&#160; [[MeatBall:AssumeGoodFaith]]
 +
 
 +
All these don't ("Bad title" error):
 +
 
 +
<nowiki>[[w:MeatBall:AssumeGoodFaith]]</nowiki> &#160;&#160; [[w:MeatBall:AssumeGoodFaith]]
 +
<nowiki>https://meta.wikimedia.org/wiki/MeatBall:AssumeGoodFaith</nowiki> &#160;&#160; https://meta.wikimedia.org/wiki/MeatBall:AssumeGoodFaith
 +
<nowiki>https://en.wikipedia.org/wiki/MeatBall:AssumeGoodFaith</nowiki> &#160;&#160; https://en.wikipedia.org/wiki/MeatBall:AssumeGoodFaith
 +
 
 +
Non-local interwiki links will still work if you type them in the search bar and choose "go".
 +
 
 +
==Wikia==
 +
In [[w:en:Wikia|Wikia]], the prefix is the ''internal'' project name for some older wikis. For others, "Wikia:c:" is added in front (e.g. <tt>[&#91;Wikia:c:psychology&#93;]</tt> or shorter <tt>[&#91;w:c:trains:locomotive&#93;]</tt>). (The "c" is for "city", a legacy of Wikia's original name ''Wikicities''.)
 +
 
 +
Note that w: only points to wikia: from other wikis on that same site; on Wikimedia projects, w: is the Wikipedia in the same language as the local wiki.
 +
 
 +
''From Wikimedia projects'', use <tt>[&#91;wikiasite:psychology&#93;]</tt>, giving [[wikiasite:psychology]]; <tt>[&#91;wikia:trains:locomotive&#93;]</tt>, giving [[wikia:trains:locomotive]]; or for the central Wikia, [[centralwikia:About Wikia]].
 +
 
 +
==Interlanguage links==
 +
:''For a complete list of current languages and language codes, see: [[w:List of Wikipedias]]''
 +
 
 +
For a multilingual family of similar projects, with one project per language, a system for '''interlanguage linking''' can be set up, setting [[mw:Manual:$wgInterwikiMagic|$wgInterwikiMagic]] to true and [[mw:Manual:$wgHideInterlanguageLinks|$wgHideInterlanguageLinks]] to false. If this project is in a family for which this applies, [[Help:Interlanguage link demo]] may demonstrate what is explained below (this depends on whether the same language codes are used).
 +
 
 +
An interwiki link within the family is treated differently, unless it is on a talk page of any namespace. It appears at one or two edges of the webpage (left in Monobook, top and bottom in Classic).
 +
 
 +
Thus, an interlanguage link is mainly suitable for linking to the most closely ''corresponding'' page in another language. It is not suitable for multiple links of the same other language. See '''[[Interlanguage use case]]''' for a discussion of common troubles with this system and other possible implementations.
 +
 
 +
The feature can also be used on an image description page, to link to the same or a similar image in a sister project. Other interwiki links to images require the prefixed colon.
 +
 
 +
Note that, if a page may be used as a [[Help:template|template]] (even if it is not in the template namespace), it should note its interlanguage links between <tt>&lt;noinclude&gt;</tt> and <tt>&lt;/noinclude&gt;</tt>. This is the same idea as for [[Help:Category|categories]].
 +
 
 +
Comparison:
 +
# <tt>[&#91;:en:link&#93;]</tt> or <tt>[&#91;:category:name&#93;]</tt> are ordinary links.
 +
# <tt>[&#91;m:en:link&#93;]</tt> or <tt>[&#91;m:category:name&#93;]</tt> are interwiki links, see above.
 +
# <tt>[&#91;category:name&#93;]</tt> without leading colon, adds a category to the page.
 +
# <tt>[&#91;en:link&#93;]</tt> without leading colon, adds an interlanguage link to the page.
 +
# <tt>&lt;noinclude&gt;[&#91;category:name&#93;]&lt;/noinclude&gt;</tt> limits it to the actual page.
 +
# <tt>&lt;noinclude&gt;[&#91;en:link&#93;]&lt;/noinclude&gt;</tt> also limits it to the actual page.
 +
 
 +
For projects like [[m:|Meta]], a missing leading colon has no effect, because Meta doesn't support interlanguage links. For [[w:|Wikipedia]] and similar projects, it is a major difference. The mutual order of interlanguage links is preserved, but otherwise the positions within the wikitext are immaterial, again the same rule as for categories. Usually they are put at the end. With section editing, they appear in the preview, if they are in the section being edited. A link to the project itself (hence, also a link to the page itself), even if referred to with the project prefix, appears in-page.
 +
 
 +
Suppose that we have pages [[:de:Zug]], [[:en:Train]] and [[:fr:Train]], then we need:
 +
* on de: [[:en:Train]], [[:fr:Train]]
 +
* on en: [[:de:Zug]], [[:fr:Train]]
 +
* on fr: [[:de:Zug]], [[:en:Train]]
 +
 
 +
Thus, there is no possibility of simply copying each list, let alone of using a template, as can be done, if different languages share one project with or without separate namespaces. For further information, see:
 +
* [[m:Template:H-langs:Interwiki linking]], used at the bottom of [[m:Help:Interwiki linking|this page on Meta]]
 +
* [[wikisource:Template:InterLingvLigoj]]
 +
* [[Template:Other languages/Meta:About|Template:About]]
 +
 
 +
===In-page interlanguage links===
 +
To make an interlanguage link in-page, prefix a colon (e.g. <nowiki>[[:en:wiki|wiki]]</nowiki>). This can be useful to link to a page in another language, if no local version is available. For example, several templates for conveniently making such links would be:
  
===Adding more===
+
* {{links-small|w|template|nli}} - <nowiki>[[:nl:{{{1}}}]] (in [[Dutch language|Dutch]])</nowiki>
As the Wikipedia isn't set up by default, you might want to add it (and other projects of your need).
+
* {{links-small|w|template|nlil}} - <nowiki>[[{{{1}}}]] ([[:nl:{{{2|{{{1}}}}}}|nl]])</nowiki>
 +
* {{links-small|w|template|nlii}} - <nowiki>''[[{{{1}}}]]'' ([[:nl:{{{2|{{{1}}}}}}|nl]])</nowiki>
 +
* {{links-small|w|template|nlis}} - <nowiki>([[:nl:{{{1|{{PAGENAME}}}}}|nl]])</nowiki>
 +
* {{links-small|w|template|nlinl}} - <nowiki>{{{1}}} ([[:nl:{{{2|{{{1}}}}}}|nl]])</nowiki>
  
You have to edit your own database.
+
===Interlanguage links in the wider sense===
Go to table <code>interwiki</code> and add a new line (usually done with phpMyAdmin):
+
An interlanguage link in the wider sense includes a link to a corresponding page in another language, which, for the software, is a regular link, as opposed to one employing the special interlanguage link ''feature'' as described above. This can also be an internal link on a multilingual project, e.g. on Meta:
*'''<code>iw_prefix</code>''': choose a prefix, which is used for interwiki linking, e.g. "wikipedia" for linking to Wikipedia
+
* [[Meta:Interlanguage links]]
*'''<code>iw_url</code>''': enter the project's URL, e.g. <code><nowiki>http://en.wikipedia.org/wiki/$1</nowiki></code> for Wikipedia. Don't forget the <code>$1</code> as it is replaced with the article's name you are linking to (<code><nowiki>[[Wikipedia:Main Page]]</nowiki></code> links to <code><nowiki>http://en.wikipedia.org/wiki/</nowiki>'''Main_Page'''</code>).
 
  
That won't work because you have to enter it as binary (bug?), So you have (or not) to add the url in a plain text file, then import it through phpmyadmin. this applies to SVN.
+
Possible reasons for using an "interlanguage link" in the page body include:
+
* control over position
*'''<code>iw_local</code>''': if 1, your wiki will redirect even external links of the form iw_prefix:title, not only those from its own pages. you need this if you want to use the redirect functionality from outside your wiki or other wikis use your transwiki functions for nested transwiki links (like http://en.wikipedia.org/wiki/fr:Accueil)
+
* control over label
*'''<code>iw_trans</code>''': "transwiki transclusion" - set to 1 if you want to use pages from the other wiki as templates.  You will also need to set [[Manual:$wgEnableScaryTranscluding|$wgEnableScaryTranscluding = true]] in your ''LocalSettings.php''
+
* the target contains an anchor
  
{{admin tip|tip=
+
==Interwiki links versus external links==
Several help pages link to MediaWiki.org's ''Manual'' namespace.  To make these links work on your local wiki, add an interwiki link with ''iw_prefix=manual'' and ''iw_url=<nowiki>http:</nowiki>//www.mediawiki.org/wiki/Manual:$1''
+
Disadvantages of interwiki links:
}}
+
* The wikitext is less portable across wikis, because wikis do not always have an interwiki prefix for the same sites and even if they do, the prefixes may differ
 +
* There is no feature to find interwiki links, while searching for an external link can be done with [[Special:Linksearch]] (if installed). This is due to the fact that, while there is an [[mw:Externallinks table|external links table]], there is no such thing for interwiki links. The [[mw:interwiki table|interwiki table]] only stores the interwiki prefixes with their targets as function of the parameter, not the instances of the links. Using the general text search, to search for interwiki links, is more work for the server and therefore, it may be slow, not up-to-date or in busy hours, disabled. See also: [[Help:What_links_here#Finding_external_links_to_a_page|Finding external links to a page]].
  
==Interwiki links to other languages==
+
Using templates like {{links-small|template|h:mlw}}, the advantages of interwiki links and external links are combined. When a page using this template, which is in this case used for links to the English Wikipedia, is copied to that site, a template with the same name is needed there too. Due to that template, {{links-small|w|template|h:mlw}}, which redirects to {{links-small|w|template|h:ml}}, the interwiki links are automatically converted to internal links. Hence, they provide existence detection and allow use of "What links here", as well as Linksearch.
[[Image:M-en-interwiki lang.png|thumb|Interwiki links to other languages]]
 
If you have installed a [[Manual:Wiki family|Wiki family]], you can link from an article in English to an article in German (if you have a German project, too). You can set up MediaWiki, to show those links in the sidebar, just below the toolbox.
 
  
In your filesystem, there is a subfolder of your MediaWiki installation, called "languages". Go there and have a look at "<code>Names.php</code>" as it contains a list of known languages and their prefixes. E.g. you want to add your German project, search "<code>Names.php</code>" for "Deutsch" and note the prefix "de".
+
Comparison:
 +
* <nowiki>[[imdbtitle:0389790|Bee Movie]]</nowiki> gives ''[[imdbtitle:0389790|Bee Movie]]''
 +
* <nowiki>[http://www.imdb.com/title/tt0389790 Bee Movie]</nowiki> gives ''[http://www.imdb.com/title/tt0389790 Bee Movie]''
 +
** [http://meta.wikimedia.org/w/index.php?title=Special%3ALinksearch&target=http%3A%2F%2Fwww.imdb.com%2Ftitle%2Ftt0389790 Linksearch] works for the latter only
  
If you know the "right" prefix, edit your database by adding a new line to table <code>interwiki</code>:
+
The applicable CSS classes are "extiw" and "external text". The choice may be governed by this, either way, for uniformity or distinction. An interwiki link is easier to type by itself, but if one goes to the webpage anyways, before putting the link, copying the URL is very convenient. When a template is created, e.g. {{tiw|imdb title}}, the template can be made, such that it uses an interwiki link and a parameter, like "tt0389790" or "0389790", or that it uses an external link and a parameter like one of those or the full url, if that is more convenient.
*'''<code>iw_prefix</code>''': language-prefix (e.g. "de" for German), which is listed in "<code>Names.php</code>"
 
*'''<code>iw_url</code>''': URL to your wiki-project (e.g. <code><nowiki>http://de.your-wiki.org/index.php/$1</nowiki></code>)
 
*'''<code>iw_local</code>''': ''same as above "Adding More"''
 
*'''<code>iw_trans</code>''': ''same as above "Adding More"''
 
  
 +
==Interwiki links to the same wiki versus internal links==
 +
Disadvantages of interwiki links to the same wiki, compared to internal links:
 +
* no existence detection
 +
* "What links here" works for internal links only
 +
* The interwiki link prefix for the same wiki should be supported otherwise it creates an invalid internal link.
  
Now, you can link an article to the same in other languages. Adding <code><nowiki>[[de:Hauptseite]]</nowiki></code> on your english Main_Page will create a link "Deutsch" below the toolbox, which leads to the Main_Page of the German wiki (Hauptseite).
+
Advantages of interwiki links to the same wiki, compared to internal links:
 +
* better portability across wikis, provided that the same prefix applies and is not equal to a namespace name
  
Note, that this link is shown in Sidebar's section, '''only''', and not inside of the article. If you want to create a link inside of the text, you have to add a colon previous to the prefix: <code><nowiki>[[:de:Hauptseite]]</nowiki></code>.
+
When using templates like {{links-small|template|h:ml}}, the advantages of internal links, interwiki links and external links are combined, provided that a template with the same name and adapted content is present on the other site.
  
{{Languages|Help:Interwiki linking}}
+
==See also==
 +
* [[mw:Help:Interwiki linking]]
 +
* {{mlm|Sister projects||Wikimedia sister projects}}
 +
* [[m:Templates for linking to sister projects]]
 +
* {{mlm|Interwiki map||Wikimedia interwiki map}}
 +
** [https://git.wikimedia.org/blob/mediawiki%2Fcore//maintenance%2Finterwiki.list Default interwiki prefixes]
 +
* {{mlww|InterWikimedia links||Interwikimedia link}} at [[Wikipedia]]
 +
* [http://tools.wikimedia.de/~flacus/IWLC/index.php Wikipedia Interwiki-Link-Checker]
 +
** [[de:Benutzer:Flacus/Wikipedia Interwiki-Link-Checker/en]] (with the Interwiki-Link-Checker, you can help to improve the internationalisation of Wikipedia)
 +
*[[MeatBall:InterWiki]]
 +
{{h:f|langs=|enname=Interwiki linking}}
  
[[Category:Help|Interwiki linking]]
+
[[Category:Editor handbook]]
[[Category:Interwiki]]
 

Latest revision as of 22:02, 10 October 2013

MediaWiki Handbook: Contents, Readers, Editors, Moderators, System admins +/-

By adding a prefix to another project, internal link style ("prefixed internal link style") can be used to link to a page of another project. A system of shorthand link labels are used to refer to different projects, in the context of interproject linking, as seen within the actual source text. For example, en: refers to the English Wikipedia. This is seen in [[en:Apple]], which produces en:Apple, a link to the English Wikipedia article on "Apple".

This is called interwiki. For each project, an interwiki map (a list of target projects with their prefixes) is specified (example). These target projects need not use MediaWiki and need not even be a wiki.

Interwiki linking from and within Wikimedia

Within Wikimedia, for the purpose of interlanguage linkshttp://en.wikipedia.org/wiki/Wikipedia:Interlanguage links (see below), the project families are Wikipedia, Wiktionary, Wikiquote, Wikibooks and Wikisource. Thus, this applies for a link like en:, de:, etc., from a Wikipedia to another one, from a Wiktionary to another one, from a Wikiquote to another one, from a Wikibooks to another one or from a Wikisource to another one.

The interlanguage link feature works on Wikimedia Commons and produces links to the Wikipedias. This is not reciprocal, a link from a Wikipedia to Commons is an in-page link.

Project titles and shortcuts

Project Long form Shortcut
Wikipedia [[wikipedia:]] [[w:]]
Wiktionary [[wiktionary:]] [[wikt:]]
Wikinews [[wikinews:]] [[n:]]
Wikibooks [[wikibooks:]] [[b:]]
Wikiquote [[wikiquote:]] [[q:]]
Wikisource [[wikisource:]] [[s:]]
Wikispecies [[wikispecies:]] [[species:]]
Wikiversity [[wikiversity:]] [[v:]]
Wikivoyage [[wikivoyage:]] [[voy:]]
Wikimedia Foundation [[wikimedia:]]
[[foundation:]]
[[wmf:]]
Wikimedia affiliates [[affiliate:]]
Wikimedia Commons [[commons:]]
Wikimedia Meta-Wiki [[metawikipedia:]]
meta:
[[m:]]
Wikimedia Incubator [[incubator:]]
MediaWiki [[mw:]]
MediaZilla / Bugzilla [[mediazilla:]]
[[bugzilla:]]
Testwiki [[testwiki:]]
Wikitech [[wikitech:]]
Wikidata [[wikidata:]] [[d:]]

* Other Wikimedia prefixes: betawikiversity:, download:, dbdump:, mail:, mailarchive:, otrs:, OTRSwiki:, quality:, spcom:, tools:, tswiki:, svn:, rev:, wmania:, wm2005:, wm2006:, wm2007:, wm2008:, wm2009:, wm2010:, wm2011:, wm2012:.

Some of the long forms don't work as expected within the same project; for example [[meta:]] doesn't work on Meta, while [[metawikipedia:]] does. This depends on the configuration of the wiki and where the names are stored (see also next paragraph). The shortcuts work everywhere. (That is the intention; currently (16-Jan-2007), it does not work on all projects.)

The interwiki map on Meta lists many prefixes, among others, [[wikipedia:]] (wikipedia:) for the English Wikipedia, working from any Wiki supporting the Meta interwiki map, not only from MediaWiki wikis. Some prefixes work only with a page, for example: wikipediawikipedia: (fails) vs. wikipediawikipedia:Interwikimedia link (works). These prefixes are case insensitive.

One-letter prefixes (as a live check on the table): Template:For Those are not real shortcuts, just interwikis with different histories. Wikipedia, Wikiquote etc. point to the English versions and are also included in the standard MediaWiki interwiki table (IIRC); w, q, b, wikt etc. are used like interlanguage wikilinks to link to the sisterproject in the same language (so w:it:b: is equivalent to Wikibooks:it:).

Non-Wikimedia interwiki codes have a limitation, that they can only be used through a link. For example, the entry for "John" on Wiktionary, a Wikimedia project, can be accessed by [[wikt:John]] or http://meta.wikimedia.org/wiki/wikt:John. However, the latter method does not work for non-Wikimedia wikis. For example, the main page on the Mozilla Wiki can be accessed via [[MozillaWiki:Main Page]], but http://meta.wikimedia.org/wiki/MozillaWiki:Main_Page results in an error.

Interwiki links on other sites

Other MediaWiki installations will support different interwiki prefixes. You may be able use the MediaWiki API to query for a site's available interwiki prefixes. Try replacing the index.php?stuff on the end of an edit or history URL with

 api.php?action=query&meta=siteinfo&siprop=interwikimap

Technical

A project's own namespace prefix cannot be reused as code for an external project. However, the prefix used for a target project may coincide with the prefix for a project namespace, within that project. As a result, to link to a page in that namespace, use the same prefix twice, for example: en:Wikisource:Wikisource:Scriptorium.

For portability across projects, one may want to select a link code that leads to the same target from all projects, for example: MetaWikipedia:wikibooks:Main Page. The "superfluous" "MetaWikipedia:" prevents "wikibooks:" being interpreted as namespace prefix, when the code is used at wikibooks itself, while at Meta the "MetaWikipedia:" is ignored (it is not a namespace prefix and even at Meta itself, it is recognized as code for Meta). The codes above work from all projects; however, the existence detection and the self-link feature do not work on interwiki links.

Prefixes

Interwiki links can use prefixes for the project and/or for the language. Without the prefix, links are local, for pages in the same project and the same language. If only a language is given, they go to a page in the same (or similar) project for the specified language:

[[:fr:]] fr:
[[:os:]] os:

If only the project is specified, they typically go to the language of the source, see above. At most, two prefixes are needed for pages in any existing project and any supported language:

[[s:de:Hauptseite]] s:de:Hauptseite
[[b:en:Main page]]  b:en:Main page

In the case of more than one prefix, a page name has to be specified. For example, while w: and en: from Meta lead to the English Wikipedia's main page, a bare [[w:en:]] does not work: w:en:.

If the language is different, specifying it before the project can also work:

[[:de:q:Hauptseite]] de:q:Hauptseite
[[:en:n:Main page]]  en:n:Main page
[[n:en:Main page]]   n:en:Main page

The second example doesn't work from English Wikipedia w:en: pages, a project prefix before the language is better.

More than two prefixes are generally unnecessary, the following examples should work everywhere:

[[m:Help:Help]] m:Help:Help
[[w:Interwiki]] w:Interwiki

Two prefixes can have unexpected effects, for example, from Meta, the following links end up on different pages:

[[m:en:About]]  m:en:About
[[:en:m:About]] en:m:About
[[m:About]]     m:About

In the first case Meta ignores the m:, because it is local and then, interprets en: as w:en:, the prefix for the English Wikipedia. In the second case, the leading en: goes to the English Wikipedia, where the following m: goes straight back to Meta. The second example doesn't work at all, from English Wikipedia w:en: pages, only the third example works everywhere.

In other words, multiple prefixes are evaluated left to right by the relevant Wikimedia servers (project and language). For projects without different languages, like Meta (because Meta is multilingual by itself), language prefixes can be handled as shorthands for w: plus the specified language:

[[:pl:2006]]   pl:2006
[[w:pl:2006]]  w:pl:2006
[[:pl:w:2006]] pl:w:2006

From Meta, the first two links both arrive at the Polish 2006 page. The third arrives at the English Wikipedia, because that's how the server selected by :pl: interprets the second prefix w:.

For a portable link on that server, it would be a bad idea to use w:, but :pl: does the trick. To test that effect from Meta, the following links should go to the same page:

[[:ja:2006]]    ja:2006
[[:ja:ja:2006]] ja:ja:2006

A universal interwiki link, that is, one that works no matter from which Wikimedia wiki, can be written [[m:project:language:page name]] (e.g. m:b:nl:Wiskunde); this routes the parsing of the links via Meta (bug 4285).

Non-local interwikis

Technically, an interwiki defined as local is one which always "forwards" to the destination: such interwikis can always be concatenated. The examples above work because all those interwikis are local in all those wikis. Interwikis which are not local in the wiki where they're concatenated or used directly won't work. The following works:

[[MeatBall:AssumeGoodFaith]]    MeatBall:AssumeGoodFaith

All these don't ("Bad title" error):

[[w:MeatBall:AssumeGoodFaith]]    w:MeatBall:AssumeGoodFaith
https://meta.wikimedia.org/wiki/MeatBall:AssumeGoodFaith    https://meta.wikimedia.org/wiki/MeatBall:AssumeGoodFaith
https://en.wikipedia.org/wiki/MeatBall:AssumeGoodFaith    https://en.wikipedia.org/wiki/MeatBall:AssumeGoodFaith

Non-local interwiki links will still work if you type them in the search bar and choose "go".

Wikia

In Wikia, the prefix is the internal project name for some older wikis. For others, "Wikia:c:" is added in front (e.g. [[Wikia:c:psychology]] or shorter [[w:c:trains:locomotive]]). (The "c" is for "city", a legacy of Wikia's original name Wikicities.)

Note that w: only points to wikia: from other wikis on that same site; on Wikimedia projects, w: is the Wikipedia in the same language as the local wiki.

From Wikimedia projects, use [[wikiasite:psychology]], giving wikiasite:psychology; [[wikia:trains:locomotive]], giving wikia:trains:locomotive; or for the central Wikia, centralwikia:About Wikia.

Interlanguage links

For a complete list of current languages and language codes, see: w:List of Wikipedias

For a multilingual family of similar projects, with one project per language, a system for interlanguage linking can be set up, setting $wgInterwikiMagic to true and $wgHideInterlanguageLinks to false. If this project is in a family for which this applies, Help:Interlanguage link demo may demonstrate what is explained below (this depends on whether the same language codes are used).

An interwiki link within the family is treated differently, unless it is on a talk page of any namespace. It appears at one or two edges of the webpage (left in Monobook, top and bottom in Classic).

Thus, an interlanguage link is mainly suitable for linking to the most closely corresponding page in another language. It is not suitable for multiple links of the same other language. See Interlanguage use case for a discussion of common troubles with this system and other possible implementations.

The feature can also be used on an image description page, to link to the same or a similar image in a sister project. Other interwiki links to images require the prefixed colon.

Note that, if a page may be used as a template (even if it is not in the template namespace), it should note its interlanguage links between <noinclude> and </noinclude>. This is the same idea as for categories.

Comparison:

  1. [[:en:link]] or [[:category:name]] are ordinary links.
  2. [[m:en:link]] or [[m:category:name]] are interwiki links, see above.
  3. [[category:name]] without leading colon, adds a category to the page.
  4. [[en:link]] without leading colon, adds an interlanguage link to the page.
  5. <noinclude>[[category:name]]</noinclude> limits it to the actual page.
  6. <noinclude>[[en:link]]</noinclude> also limits it to the actual page.

For projects like Meta, a missing leading colon has no effect, because Meta doesn't support interlanguage links. For Wikipedia and similar projects, it is a major difference. The mutual order of interlanguage links is preserved, but otherwise the positions within the wikitext are immaterial, again the same rule as for categories. Usually they are put at the end. With section editing, they appear in the preview, if they are in the section being edited. A link to the project itself (hence, also a link to the page itself), even if referred to with the project prefix, appears in-page.

Suppose that we have pages de:Zug, en:Train and fr:Train, then we need:

Thus, there is no possibility of simply copying each list, let alone of using a template, as can be done, if different languages share one project with or without separate namespaces. For further information, see:

In-page interlanguage links

To make an interlanguage link in-page, prefix a colon (e.g. [[:en:wiki|wiki]]). This can be useful to link to a page in another language, if no local version is available. For example, several templates for conveniently making such links would be:

Interlanguage links in the wider sense

An interlanguage link in the wider sense includes a link to a corresponding page in another language, which, for the software, is a regular link, as opposed to one employing the special interlanguage link feature as described above. This can also be an internal link on a multilingual project, e.g. on Meta:

Possible reasons for using an "interlanguage link" in the page body include:

  • control over position
  • control over label
  • the target contains an anchor

Interwiki links versus external links

Disadvantages of interwiki links:

  • The wikitext is less portable across wikis, because wikis do not always have an interwiki prefix for the same sites and even if they do, the prefixes may differ
  • There is no feature to find interwiki links, while searching for an external link can be done with Special:Linksearch (if installed). This is due to the fact that, while there is an external links table, there is no such thing for interwiki links. The interwiki table only stores the interwiki prefixes with their targets as function of the parameter, not the instances of the links. Using the general text search, to search for interwiki links, is more work for the server and therefore, it may be slow, not up-to-date or in busy hours, disabled. See also: Finding external links to a page.

Using templates like template:h:mlw ( talk edit history links ), the advantages of interwiki links and external links are combined. When a page using this template, which is in this case used for links to the English Wikipedia, is copied to that site, a template with the same name is needed there too. Due to that template, w:template:h:mlw ( talk edit history links ), which redirects to w:template:h:ml ( talk edit history links ), the interwiki links are automatically converted to internal links. Hence, they provide existence detection and allow use of "What links here", as well as Linksearch.

Comparison:

  • [[imdbtitle:0389790|Bee Movie]] gives Bee Movie
  • [http://www.imdb.com/title/tt0389790 Bee Movie] gives Bee Movie

The applicable CSS classes are "extiw" and "external text". The choice may be governed by this, either way, for uniformity or distinction. An interwiki link is easier to type by itself, but if one goes to the webpage anyways, before putting the link, copying the URL is very convenient. When a template is created, e.g. w:Template:Imdb title, the template can be made, such that it uses an interwiki link and a parameter, like "tt0389790" or "0389790", or that it uses an external link and a parameter like one of those or the full url, if that is more convenient.

Interwiki links to the same wiki versus internal links

Disadvantages of interwiki links to the same wiki, compared to internal links:

  • no existence detection
  • "What links here" works for internal links only
  • The interwiki link prefix for the same wiki should be supported otherwise it creates an invalid internal link.

Advantages of interwiki links to the same wiki, compared to internal links:

  • better portability across wikis, provided that the same prefix applies and is not equal to a namespace name

When using templates like template:h:ml ( talk edit history links ), the advantages of internal links, interwiki links and external links are combined, provided that a template with the same name and adapted content is present on the other site.

See also

Links to other help pages

Help contents
Meta · Wikinews · Wikipedia · Wikiquote · Wiktionary · Commons: · mw: · b: · s: · mw:Manual · Google
Versions of this help page (for other languages see further)
Meta · Wikinews · Wikipediahttp://en.wikipedia.org/index.php/Help:Interwiki_linking · Wikiquote · Wiktionary
What links here on Meta or from Meta · Wikipedia · MediaWiki
Reading
Go · Search · Stop words · Namespace · Page name · Section · Backlinks · Redirect · Category · Image page · Special pages · Printable version
Tracking changes
Recent changes (enhanced) | Related changes · Watching pages · Diff · Page history · Edit summary · User contributions · Minor edit · Patrolled edit
Logging in and preferences
Logging in · Preferences · User style
Editing
Starting a new page · Advanced editing · Editing FAQ · Edit toolbar · Export · Import · Shortcuts · Edit conflict · Page size
Referencing
Links · URLs · Piped links · Interwiki linking · Footnotes
Style and formatting
Wikitext examples · CSS · Reference card · HTML in wikitext · Formula · List · Table · Sorting · Colors · Images and file uploads
Fixing mistakes
Show preview · Testing · Reverting edits
Advanced functioning
Expansion · Template · Advanced templates · Parser function · Parameter default · Variable · System message · Substitution · Array · Calculation · Embed page
Others
Special characters · Renaming (moving) a page · Talk page · Signatures · Sandbox · Legal issues for editors