DokuWiki

It's better when it's simple

User Tools

Site Tools


interwiki

This is an old revision of the document!


InterWiki Links

The original idea of InterWiki was to have one large distributed Wiki over the whole net. Today its more of an easy way to link from one wiki to another by having some simple link syntax to do so.

In DokuWiki this is done by prefixing Wiki pagenames with a shortcut separated by a > character.

Examples:

[[wp>Wiki]] links to Wikipedia,
[[Meatball>TourBusStop]] links to the MeatBall wiki TourBusStop,
[[google>Wiki]] links to a google search,
[[doku>interwiki]] links to this page.

Wiki links to Wikipedia, TourBusStop links to the MeatBall wiki TourBusStop, Wiki links to a Google search. interwiki links to this page.

There is one special interwiki shortcut called this. It always links to the webserver directory DokuWiki is installed in. You can use this to construct relative URLs. For example the following always links to the local XML feed: feed.php

[[this>feed.php]]

More Info on InterWiki:

  • InterWiki at Wikipedia
  • InterWiki at MeatBall
  • InterWiki at c2.com Wiki

Configuring InterWiki Shortcuts

InterWiki shortcuts are defined in the conf/interwiki.conf file. The default file contains all shortcuts suggested in http://usemod.com/intermap.txt. You can add your own interwiki links by creating a conf/interwiki.local.conf file and placing your links in that file (this will prevent the links from being overwritten on a update).

It is possible to modify Dokuwiki’s conf/interwiki.conf file, however this could result in your changes being overwritten when upgrading Dokuwiki.

You can place imagefiles named after the shortcut in the lib/images/interwiki directory to use them instead of the default icon. They should have a size of 16×16 pixels and be in PNG or GIF format. You should also purge the cache if you have the default image instead of the one you uploaded.

rm -rf <path-to-dokuwiki>/data/cache/*

The interwiki shortcut has to be in lowercase and follow the pagename rules.

The format of the interwiki config file is:

<shortcut>      <url to wiki>

The shortcut is the one you will be able to use in the link later. In the URL you can use some placeholders to be more flexible in linking. If no placeholder is given the URL-encoded wikiname will be appended to the URL. These placeholders are available:

Placeholder Replaced by
{URL} URL-encoded wikiname (the part which is appended to the url in interwiki.local.conf)
{NAME} wikiname without any encoding
{SCHEME} scheme part if an URL was given as wikiname
{HOST} host part if an URL was given as wikiname
{PORT} port part if an URL was given as wikiname
{PATH} path part if an URL was given as wikiname
{QUERY} query part if an URL was given as wikiname

The last 5 parameters are useful when creating interwikilinks to cachesystems. Refer to the coral shortcut in the distributed interwiki.conf. Examples of these placeholders can found in conf/interwiki.conf

For example, Ubuntu's wiki uses namespaces and pagenames like this “LaptopTestingTeam/ToshibaPortegeM700” and without using {NAME} as a placeholder in your interwiki.local.conf file, you'll get a Not Found error on their wiki, because it'll interpet the forward slash as a %2F ; so what you can do is add this line to your interwiki.local.conf:

ubuntu https://wiki.ubuntu.com/{NAME}

and now create your link to it like this:

[[ubuntu>LaptopTestingTeam/ToshibaPortegeM700|Ubuntu Linux on Toshiba Portege M700 Tablet]]
interwiki.1260021220.txt.gz · Last modified: 2009-12-05 14:53 by kazmiya

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki