summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--IkiWiki.pm6
-rw-r--r--doc/plugins/write.mdwn4
2 files changed, 10 insertions, 0 deletions
diff --git a/IkiWiki.pm b/IkiWiki.pm
index a4afef8e0..ee0b1f1ea 100644
--- a/IkiWiki.pm
+++ b/IkiWiki.pm
@@ -1148,6 +1148,12 @@ sub urlto ($$;$) {
return $config{url}.beautify_urlpath("/".$to);
}
+ if (! defined $from) {
+ my $u = $local_url;
+ $u =~ s{/$}{};
+ return $u.beautify_urlpath("/".$to);
+ }
+
my $link = abs2rel($to, dirname(htmlpage($from)));
return beautify_urlpath($link);
diff --git a/doc/plugins/write.mdwn b/doc/plugins/write.mdwn
index 6b751f0cd..33db3e707 100644
--- a/doc/plugins/write.mdwn
+++ b/doc/plugins/write.mdwn
@@ -988,6 +988,10 @@ Construct a relative url to the first parameter from the page named by the
second. The first parameter can be either a page name, or some other
destination file, as registered by `will_render`.
+If the second parameter is `undef`, the URL will be valid from any page on the
+wiki, or from the CGI; if possible it'll be a path starting with `/`, but an
+absolute URL will be used if the wiki and the CGI are on different servers.
+
If the third parameter is passed and is true, an absolute url will be
constructed instead of the default relative url.