Take the 2-minute tour ×
Web Applications Stack Exchange is a question and answer site for power users of web applications. It's 100% free, no registration required.

With wiki markup is it possible to link to a relative path?

eg:

[../rel/path Link Text]

I am using DokuWiki.

share|improve this question

1 Answer 1

up vote 4 down vote accepted

Possible solution for DokuWiki

A post in the DokuWiki User Forum "Relative links in wikipages" mentions this tag.

It gives a path to the wiki root, so a link like this one [[this>../../VolD/Projects/]] can link to some page outside the wiki folder without using a full URL.

See also the official documentation: https://www.dokuwiki.org/interwiki


The rest of this answer was written before I knew that the question was about DokuWiki. I'll leave it for future reference.

The problem if you're using MediaWiki

In a wiki, it can be ambiguous to use relative paths because it is common to rewrite URLs. Let's take Wikipedia as an example. When you access http://en.wikipedia.org/wiki/Main_Page, you're not looking at a document called Main_Page in /wiki. Instead, it is /w/index.php that does the work, as you can see from http://en.wikipedia.org/w/index.php?title=Main_Page returning the same output. So, relative URLs will introduce an ugly ambiguity here. Relative from where? (See also http://yoast.com/relative-urls-issues/) As the rewritten URL can be anything, it won't be smart to rely on relative paths.

Workaround for MediaWiki

I suspect that the reason you want to use a relative path is because you want to link to a file on the same server, but is not managed within the wiki's database. In that case, you can use the magic word {{SERVERNAME}}.

[http://{{SERVERNAME}}/rel/path Link text]

should give you the link, with {{SERVERNAME}} replaced accordingly (see here). Taking Wikipedia as an example, {{SERVERNAME}} = "en.wikipedia.org".

So this is not exactly a relative path, but playing around with other magic words such as {{SCRIPTPATH}} and {{STYLEPATH}} might offer you a solution, depending on what directory you want to access. (For the Wikipedia example, {{SCRIPTPATH}} = "/w".) See http://www.mediawiki.org/wiki/Help:Magic_words#Technical_metadata

share|improve this answer
    
Thanks for your answer. You're right in what I wanted to do, but I imagine that SERVERNAME is set manually, my problem is that the server will be accessed internally and externally under different effective servernames. I am also using Doku currently which apparently doesn't support SERVERNAME, but your answer is useful and helpful nonetheless, thanks again. –  Jamie Kitson Aug 20 '13 at 10:32
1  
@JamieKitson You should've said first that you're using DokuWiki! Updated my answer ;-) –  Asa Aug 20 '13 at 15:27
    
Sorry, and thanks! –  Jamie Kitson Aug 20 '13 at 16:05

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.