[Home]SelfReferringInterWiki

MeatballWiki | RecentChanges | Random Page | Indices | Categories

On pages like UseMod:System, RecentChangesOptions, and on other places on most sites, documentation takes the form of links to the self-same script. Currently the choice (locally) has been to use the wiki's own InterWiki prefix ala MeatBall:action=rc (for example) but that makes copying and pasting the documentation difficult.

Certainly others have had this problem. Witness JerryMuelver's [wiki in a file] (broken link, Jan 2004) where users have to search and replace MeatBall: for their own site name on RecentChangesOptions.

One may suggest that instead of hard-coding the site URL in these links (http://www.usemod.com/cgi-bin/mb.pl?action=version), why not use relative links (http:mb.pl?action=version)? Well, first this is not compliant to the URL definition (RFC 1808). Browsers that adhere strictly to that document (Lynx, Mozilla) will not be able to use that link. Second, not all sites will name their script mb.pl!

Another suggestion is to create a SelfReferringInterWiki moniker, such as Here. That way, users can simply define Here to point to their local site (or it could be configured automatically), and users would be able to simply copy&paste the documentation pages into their own wikis. For example: Here:action=rc

Suggested Monikers

Technical issues

On a technical front, things get a little dicey. Right now, MeatballWiki and UseModWiki use the same InterMap file. This is the infamous http://meatballwiki.org/intermap.txt. Many WikiFarms will be in similar situation as well. Consequently, you can't add the SelfReferringInterWiki moniker to the global InterMap because each wiki needs a different one. Therefore, generate it automagically and dynamically from the base URL of the script. That has the added benefit of "moving with the script"; so when you move the script from one location to another, you won't have to manually modify anything, much in the same way MoinMoin benefited from using PersistentUniformResourceLocators when it moved.

MoinMoin 0.11 automagically adds Self: to the list. -- jh

If the InterWiki Mechanism can determine if the site being refered to is the site currently hosting the wiki rather than another Wiki, then the WikiMentor? can configure This or whatever the user community wants in the InterMap. I assume that each site needs its own Intermap Instance as not all Wikis necesarily will be propagaged to all sites. --AndrewMiller

I created a newglobal variable $LocalLink which has the text of the string to be replaced - I use ''local:'' and then replaces this with $q->url() in the CommonMarkup. There is a slight subtlety here what gets replaced is local:? and local:/ . local:? is replaced by $q->url().'?' and local:/ is replaced by just the protocol, host and port (e.g. http://www.usemod.com:80/) which allows easy linking to non-wiki pages or images as in local:/images/logo.gif or local:/perl/ which change to http://www.usemod.com:80/images/logo.gif and http://www.usemod.com:80/perl/ respectively the patch is this block added before line 1203
 if ($FreeLinks) {
:

    if ($LocalLink) {
	$q->url() =~ m!(.*?://[^/]+/)(.*)!;
	my %LocalPatterns = ($LocalLink.'?'=>$1.$2.'?',$LocalLink.'/'=>$1);
	s/($LocalLink(?:\?|\/))/$LocalPatterns{$1}/g;
    }
  -- Francis Turner

[CategoryWikiTechnology] [CategoryUncommonWikiTechnology]

Discussion

MeatballWiki | RecentChanges | Random Page | Indices | Categories
Edit text of this page | View other revisions
Search: