The Wayback Machine - https://web.archive.org/web/20101203112631/http://www.mediawiki.org/wiki/Manual:Interwiki

Manual:Interwiki

From MediaWiki.org
Jump to: navigation, search

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).

A link like [[Wikipedia:Main Page]] will appear like this: Wikipedia:Main Page and redirect you to Wikipedia's Main Page.

Contents

[edit] Interwiki links to other projects

Interwiki links are hosted in the interwiki table of the Mediawiki database.

[edit] Default

Several Wikimedia projects (and others) are ready for interwiki linking by default, so you can use them without editing your database. Note that Wikipedia was only added as one of the interwiki defaults since v1.10

The following are some examples of interwiki prefixes which are available by default:

prefix destination URL usage example
commons http://commons.wikimedia.org/wiki/ [[commons:MediaWiki]]
mediazilla http://bugzilla.wikimedia.org/ [[mediazilla:1209]]
meta http://meta.wikimedia.org/wiki/ [[meta:Main Page]]
mediawikiwiki or mw[1] http://www.mediawiki.org/wiki/ [[mediawikiwiki:Help:Contents]] or [[mw:Help:Contents]]
wikibooks http://en.wikibooks.org/wiki/ [[wikibooks:Main Page]]
wikimedia http://wikimediafoundation.org/wiki/ [[wikimedia:Main Page]]
wikinews http://en.wikinews.org/wiki/ [[wikinews:Main Page]]
wikiquote http://en.wikiquote.org/wiki/ [[wikiquote:Main Page]]
wikisource http://en.wikisource.org/wiki/ [[wikisource:Main Page]]
wikispecies http://species.wikimedia.org/wiki/ [[wikispecies:Main Page]]
wiktionary http://en.wiktionary.org/wiki/ [[wiktionary:Main Page]]
wikipedia http://en.wikipedia.org/wiki/ [[wikipedia:Main Page]]
Note: In some installations none of these is pre-installed. Try [[metawikipedia:Main Page]] in this case.

[edit] Adding a new website for interwiki linking

As the Wikipedia isn't set up by default in version 1.9 and before, you might want to add it (and other projects that you desire).

The examples below show how to set up w: as a link to the English Wikipedia.

The idea is to insert a line of the form:

('prefix', 'URL format string', 1, 0)

into the interwiki table.

[edit] Single line

Advanced users may use a single command line, as follows:

INSERT INTO interwiki SET iw_prefix='w', iw_url='http://en.wikipedia.org/wiki/$1', iw_local=1, iw_trans=0 ;
INSERT INTO interwiki (iw_prefix, iw_url, iw_local, iw_trans) VALUES ('w', 'http://en.wikipedia.org/wiki/$1', 1, 0);

[edit] Export, add, re-import

Alternatively, you can use the following multi-step process, which exports the interwiki table, adds a line, then re-imports it:

('w', 'http://en.wikipedia.org/wiki/$1', 1, 0);
Note: in the above code, the semicolon ';' as seen, MUST be at the end of the table. At the end of any other line within that table Only has ','.

[edit] To test

To test configuration:

[edit] Field documentation

In detail, the fields of the interwiki database table are as follows:

Tools.svg Tip for wiki admins: 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=http://www.mediawiki.org/wiki/Manual:$1

[edit] Interwiki links to other languages

Interwiki links to other languages

If you have installed a 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 "Names.php" as it contains a list of known languages and their prefixes. E.g. you want to add your German project, search "Names.php" for "Deutsch" and note the prefix "de".

If you know the "right" prefix, edit your database by adding a new line to table interwiki:

Now, you can link an article to the same in other languages. Adding [[de:Hauptseite]] on your English Main_Page will create a link "Deutsch" below the toolbox, which leads to the Main_Page of the German wiki (Hauptseite).

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: [[:de:Hauptseite]].

[edit] References

  1. "mw" prefix is only in the default interwiki prefixes since MediaWiki 1.16

[edit] See also

Language: English  • Español • Suomi • Français • 日本語 • 한국어 • Română • Русский
Personal tools
Namespaces
Variants
Actions
Site
Support
Download
Development
Communication
Toolbox