Help:Interwiki linking

From BRL-CAD
PD
Important note: When you edit this page, you agree to release your contribution into the public domain. If you don't want this or can't do this because of license restrictions, please don't edit. This page is one of the Public Domain Help Pages, which can be freely copied into fresh wiki installations and/or distributed with MediaWiki software; see Help:Contents for an overview of all pages.

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.

Interwiki links to other projects[edit]

Default[edit]

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]]
mw http://www.mediawiki.org/wiki/ [[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]]

Template:Note

Adding a new website for interwiki linking[edit]

For setting up interwiki links, you might need to edit the database. Alternatively you might prefer to install an Interwiki extension.

Template:Note

(Advanced users of PostgreSQL use INSERT INTO interwiki (iw_prefix, iw_url, iw_local, iw_trans) VALUES ('w', 'http://en.wikipedia.org/wiki/$1', 1, 0);)

  • Export the database table 'interwiki' then add to the end of the table the following kayakwiki example...
  • ('kayakwiki', 'http://en.kayakwiki.org/index.php/$1', 1, 0);
    Template:Note
  • Import the database table 'interwiki'
  • To test it: Go to your site, create an article, with the following content.
  • [[kayakwiki:Places|]] will display a link to the 'Places' page on KayakWiki.org (the url http://en.kayakwiki.org/index.php/Places)

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

The fields of the interwiki database table are as follows:

  • iw_prefix: choose a prefix, which is used for interwiki linking, e.g. "wikipedia" for linking to Wikipedia.
    Template:Note
  • iw_url: enter the project's URL, e.g. http://en.wikipedia.org/wiki/$1 for Wikipedia. Don't forget the $1 as it is replaced with the article's name you are linking to ([[Wikipedia:Main Page]] links to http://en.wikipedia.org/wiki/Main_Page).
    Template:Note
  • iw_local: 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)
  • iw_trans: "transwiki transclusion" - set to 1 if you want to use pages from the other wiki as templates. You will also need to set $wgEnableScaryTranscluding = true in your LocalSettings.php
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

Interwiki links to other languages[edit]

File:M-en-interwiki lang.png
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:

  • iw_prefix: language-prefix (e.g. "de" for German), which is listed in "Names.php"
  • iw_url: URL to your wiki-project (e.g. http://de.your-wiki.org/index.php/$1)
  • iw_local: same as above "Adding More"
  • iw_trans: same as above "Adding More"


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

See also[edit]

External links[edit]

Template:Meta