Compute local paths to the top of the wiki
authorSimon McVittie <smcv@debian.org>
Mon, 22 Nov 2010 23:13:52 +0000 (23:13 +0000)
committerSimon McVittie <smcv@debian.org>
Mon, 22 Nov 2010 23:13:52 +0000 (23:13 +0000)
commit8f64c69e084c698a389565203bd18bccb33f5d69
tree8cfac53df0429dbd78fe32c0f19b34dcb1f02f6b
parent1968317cacc2f555af17286acf26a60ce616cc40
Compute local paths to the top of the wiki

"local" here is short for "locally valid" - the idea is that we can use
URLs that are relative in the sense of only having the path part, but
absolute in the sense that they start from '/', such as
'/~smcv/ikiwiki.cgi'. There's no particularly good name that I can find
for these between-relative-and-absolute URLs.

They're useful because in the common case where the pages and the CGI
script have the same scheme and authority component, each page is
identified by the same locally-valid URL when linking from any page or
from the CGI, without hard-coding a choice between HTTP and HTTPS, or
between multiple virtual hostnames with the same path layout. As such,
we can use them in many situations that previously used an absolute URL.

If there's no suitable semi-absolute value for local_url (for instance,
if your pages and your CGI reside on different servers), we can just fall
back to using the absolute URL. I append '/' because $config{url} doesn't
end with '/', but the common case for local_url (on all branchable.com
sites, for instance) is that it's just '/'.
IkiWiki.pm