Button Button

Sputnik supports Interwiki links.

Interwiki links can be configured through the INTERWIKI parameter in sputnik/config. The parameter is set to a table. The keys in the table correspond to interwiki prefices, while the values can be either string templates or functions. For example:

INTERWIKI = {
   sputnik = "http://spu.tnik.org/en/",
   wikipedia = "http://en.wikipedia.org/wiki/%s",
   ["lua-users"] = function(node_name)
                      local prefix = "http://lua-users.org/wiki/"
                      return prefix..node_name:gsub("%s", "")
                   end
}

So, [[sputnik:Installation]] will link to the "Installation" page on http://spu.tnik.org/, [[wikipedia:Sputnik (software)|Sputnik on Wikipedia]] will link to http://en.wikipedia.org/wiki/Sputnik_(software), and [[lua-users:Lua Addons]] would link to http://lua-users.org/wiki/LuaAddons.

This method can be used, among other things, to link to sister wikis in another language. E.g., you could define

pt = "/pt/"

in the English wiki, and then link to Portuguese pages with links like [[pt:Usando OpenOCD]].

The same method can be extended to non-wiki sites. If you set

isbn = "http://www.amazon.com/gp/product/"

then [[isbn:8590379825]] will link to Amazon's page for PiL2.

Or, you can write:

isbn = function(node_name)
            return "http://www.amazon.com/gp/product/"
               ..node_name
               .."?tag=<your_associate_id>-20"

to make sure than links like [[isbn:8590379825]] bring you referral credit.

Or, you can do the same with

isbn = "http://www.amazon.com/gp/product/%s?tag=<your_associate_id>-20"

Note that for interwiki rules with values set to strings, Sputnik will look for %s and try to put the node name there. If it doesn't find it, the node name will just get appended at the end.

See also list/interwiki links.