With wiki markup is it possible to link to a relative path?
eg:
[../rel/path Link Text]
I am using 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.
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.
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
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.
Commented
Aug 20, 2013 at 10:32