Help:Interwiki linking
From Phonology
Contents |
[edit] General
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. For example, [[wikipedia:InterWiki]]
links to the InterWiki article on the English Wikipedia. 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.
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, e.g. 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, e.g. MetaWikipedia:wikibooks:Main Page. The "superfluous" "MetaWikipedia:" prevents "wikibooks:" to be 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.
[edit] Interwiki linking from and within Wikimedia
Within Wikimedia, for the purpose of interlanguage links (see above) 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 Commons, and produces links to the Wikipedias. This is not reciprocal: a link from a Wikipedia to Commons is an in-page link.
[edit] Project titles and shortcuts
Prefix | Example | Shortcut |
---|---|---|
[[wikibooks:]]
| wikibooks: | [[b:]] b:
|
[[meta:]]
| meta: | [[m:]] m:
|
http://www.mediawiki.org/ | [[mw:]] mw:
| |
[[wikinews:]]
| wikinews: | [[n:]] n:
|
[[wikiquote:]]
| wikiquote: | [[q:]] q:
|
[[wikisource:]]
| wikisource: | [[s:]] s:
|
[[wikipedia:]]
| wikipedia: | [[w:]] w:
|
[[wiktionary:]]
| wiktionary: | [[wikt:]] wikt:
|
[[commons:]]
| commons: | |
[[google:]]
| google: | used for google queries |
[[mediazilla:]]
| mediazilla: | used with bug numbers |
[[sep11:]]
| sep11: | |
[[wikispecies:]]
| wikispecies: |
The long form doesn't work within the same project. The shortcut works everywhere.
[edit] Prefixes
Interwiki links can use prefixes for the project and/or for the language. Without 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 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, e.g. 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's local, and then interprets
en:
as w:en:
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
[edit] 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:chicago]]
).
From outside, e.g. from Wikimedia projects, "wikia:c:" is added in front, for example wikia:c:Trains:Catégorie:Chronologie.
[edit] Interlanguage link
For a multilingual family of similar projects, with one project per language, a system for interlanguage linking can be set up. 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, and top and bottom in Classic). The link label depends only on the sister project that is linked to, not on the linked page. The label is set in the configuration of the project. Typically, it is the name of the language written in that language. The target is only shown in the status bar, depending on the browser (oddly, there is not even a hover box).
Thus, interlanguage link is mainly suitable for linking to the 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 not have an interlanguage link; such a link appears in the edge of the page that includes the template, giving the impression that the link is to a version of the referring page in the other language. For the same reason, pages in the MediaWiki namespace are not suitable to put an interlanguage link in.
The mutual order of interlanguage links is preserved, but otherwise the positions within the wikitext are immaterial. 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, fr:Train then we need:
Thus there is not the 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, see e.g.:
- Template:H-langs:Interwiki linking used at the bottom of the master copy of this page on Meta
- wikisource:Template:InterLingvLigoj
- Template:About.
Examples of project families with interlanguage links:
- several Wikimedia project families, see below
- a family of six Wikia projects, see wikicities:c:WikiMac:WikiMac:Interlanguage links
[edit] In-page interlanguage links
To make an interlanguage link in-page, prefix a colon (e.g. [[:en:wiki|wiki]]). This can e.g. be useful to link to a page in another language if no local version is available. See also some example templates for conveniently making such links:
- Template:Tiw - [[:nl:{{{1}}}]] (in [[Dutch language|Dutch]])
- Template:Tiw - [[{{{1}}}]] ([[:nl:{{{2|{{{1}}}}}}|nl]])
- Template:Tiw - ([[:nl:{{{1|{{PAGENAME}}}}}|nl]])
- Template:Tiw - ''[[{{{1}}}]]'' ([[:nl:{{{2|{{{1}}}}}}|nl]])
[edit] Interlanguage link in the wider sense
An interlanguage link in the wider sense includes what, for the software, is a regular link, also an internal one on projects which are shared by different languages: Meta and Wikisource, see:
Possible reasons for using an "interlanguage link" in the page body include:
- control over position
- control over label
- especially useful in the case of a page used as a template, so that on the referring page the link label can explain what the link target is.
- the target contains an anchor