Open main menu

lensowiki β

Changes

Help:Interwiki linking

12,601 bytes added, 07:28, 17 July 2006
General
{{H:h|editor toc}}

==General==

By adding a prefix to another project, internal link style ("prefixed internal link style") can be used to [[Help:Link|link]] to a page of another project. For example, <code><nowiki>[[wikipedia:InterWiki]]</nowiki></code> links to the [[wikipedia:InterWiki|InterWiki]] article on the English Wikipedia. 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.

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:" 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#Linking_from_a_page|existence detection]] and the [[Help:Self link|self-link feature]] do not work on interwiki links.

==Interwiki linking from and within Wikimedia==
Within [[m:Wikimedia|Wikimedia]], for the purpose of [[w:en:interlanguage link|interlanguage link]]s (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.

===Project titles and shortcuts===
{|
! Prefix
! Example
! align="left" | Shortcut
|-
| <code>[&#91;wikibooks:&#93;]</code>
| [[wikibooks:]]
| <code>[&#91;b:&#93;]</code> [[b:]]
|-
| <code>[&#91;meta:&#93;]</code>
| [[meta:]]
| <code>[&#91;m:&#93;]</code> [[m:]]
|-
| colspan="2" | http://www.mediawiki.org/
| <code>[&#91;mw:&#93;]</code> [[mw:]]
|-
| <code>[&#91;wikinews:&#93;]</code>
| [[wikinews:]]
| <code>[&#91;n:&#93;]</code> [[n:]]
|-
| <code>[&#91;wikiquote:&#93;]</code>
| [[wikiquote:]]
| <code>[&#91;q:&#93;]</code> [[q:]]
|-
| <code>[&#91;wikisource:&#93;]</code>
| [[wikisource:]]
| <code>[&#91;s:&#93;]</code> [[s:]]
|-
| <code>[&#91;wikipedia:&#93;]</code>
| [[Wikipedia:]]
| <code>[&#91;w:&#93;]</code> [[w:]]
|-
| <code>[&#91;wiktionary:&#93;]</code>
| [[wiktionary:]]
| <code>[&#91;wikt:&#93;]</code> [[wikt:]]
|-
| <code>[&#91;commons:&#93;]</code>
| [[commons:]]
|
|-
| <code>[&#91;foundation:&#93;]</code>
| [[foundation:]]
| align="right" | <small>same as [[wikimedia:]]</small>
|-
| <code>[&#91;google:&#93;]</code>
| [[google:]]
| align="right" | <small>used for google queries</small>
|-
| <code>[&#91;mediazilla:&#93;]</code>
| [[mediazilla:]]
| align="right" | <small>used with bug numbers</small>
|-
| <code>[&#91;sep11:&#93;]</code>
| [[sep11:]]
|
|-
| <code>[&#91;wikimedia:&#93;]</code>
| [[wikimedia:]]
|
|-
| <code>[&#91;wikispecies:&#93;]</code>
| [[wikispecies:]]
|
|-
| <code>[&#91;incubator:&#93;]</code>
| [[incubator:]]
|
|}

''The '''long''' form doesn't work within the same project. The '''shortcut''' works everywhere.''

The [[m:Interwiki map|Interwiki map]] on Meta lists many prefixes, among others
<code>[&#91;wikipedia:&#93;]</code> [[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, e.g. [[wikipediawikipedia:]] (fails) vs. [[wikipediawikipedia:Interwikimedia link]] (works).
These prefixes are case insensitive.

===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:

<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, e.g. 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's local, and then interprets
<code>en:</code> as <code>w:en:</code> 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]]

==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:sydney&#93;]</tt>
or shorter <tt>[&#91;w:c:trains:locomotive&#93;]</tt>).

From Wikimedia projects use <tt>[&#91;wikiasite:sydney&#93;]</tt> [[wikiasite:sydney]]
or <tt>[&#91;wikia:trains:locomotive&#93;]</tt> [[wikia:trains:locomotive]].

==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 [[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.<br /><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> limited to actual page.<br /><tt>&lt;noinclude&gt;[&#91;en:link&#93;]&lt;/noinclude&gt;</tt> ditto limited to actual page.

For projects like [[m:|Meta]] a missing leading colon has no effect, Meta doesn't support Interlanguage links. For [[w:|Wikipedia]] and similar projects it's 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]], [[: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 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 [[m:Help:Interwiki linking|this page on Meta]]
*[[wikisource:Template:InterLingvLigoj]]
*[[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 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: {{tiw|en|nli}}, {{tiw|en|nlil}}, {{tiw|en|nlis}}, and {{tiw|en|nlii}}.

===Interlanguage link 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 ''feeature'' as described above. This can also be an internal link on a multilingual project, e.g. on Meta:

*[[Meta:Interlanguage links]]

Possible reasons for using an "interlanguage link" in the page body include:
*control over position
*control over label
*the target contains an anchor

==See also==

*[[m:Help:Guide for system administrators for setting up interwiki linking]]
*[[m:Sister projects]]
*[[w:en:Wikipedia:Sister projects]]
*[[m:Interwiki bot access protocol]]
*[[m:Interwiki map]] (used to rebuild map)
*[http://svn.wikimedia.org/svnroot/mediawiki/trunk/phase3/maintenance/interwiki.sql interwiki prefixes] (SQL subversion source)

{{h:f|langs=|enname=Interwiki linking}}
Anonymous user