From: "Charlotte Webb" charlottethewebb@gmail.com Date: 2007/12/20 Thu PM 12:33:41 EST To: "Wikimedia developers" wikitech-l@lists.wikimedia.org Subject: Re: [Wikitech-l] Relative External Links?
On 12/20/07, Andre-John Mas ajmas@sympatico.ca wrote:
I have recently installed Mediawiki as part of my website. Because I am integrating it into an existing site I need to be able to link to stuff already there. The issue I am currently having is that the site is accessed via two URLs (internal and external). For this reason I need links refering to the existing site to be relative.
If understand correctly, you're saying the second half of such a link (to non-mediawiki parts of your site) remains the same, but the first half varies depending on how the site is being accessed.
If this is the case, and if the "internal" URL is only used by the webmaster (you), you could probably "internalize" all of the links (for you only) using a personal javascript at "User:Your_account_on_the_wiki/monobook.js" by doing a search and replace on all urls matching the "external" format.
Something like:
addOnloadHook(function(){ a = document.getElementsByTagName("a"); for(x = 0; x < a.length; x++) a[x].href = a[x].href.replace(/yoursite.com/i, "back.door.of.yoursite.com"); });
I would like to make the support a bit more general this, allowing for links such as:
[/page page]
If I knew which class/method was responsible for parsing this I would be willing to see what it would take to make the changes, since I am not afraid of diving in, its just I don't where I should be looking.
Any ideas?
Andre