append index.html to url generated by urlto("")

This special case crops up when generating the parentlink to the toplevel
index page. urlto("") had been generating a link to "./" (or "../" etc)
for that, which is fine, if the web server redirects that to the toplevel
index.html. It's less fine if there is no web server.

I actually ran into the problem first when using gopher. (Yes, yes, don't
laugh.. see upcoming tip.) But it also crops up when browsing local wiki
files.

Of course, the index.html is stripped back off if usedirs is enabled.
master
Joey Hess 2008-06-15 15:04:10 -04:00
parent 0415917f1e
commit 5e6a6b1086
2 changed files with 8 additions and 1 deletions

View File

@ -547,7 +547,7 @@ sub urlto ($$) { #{{{
my $from=shift; my $from=shift;
if (! length $to) { if (! length $to) {
return beautify_url(baseurl($from)); return beautify_url(baseurl($from)."index.$config{htmlext}");
} }
if (! $destsources{$to}) { if (! $destsources{$to}) {

7
debian/changelog vendored
View File

@ -1,3 +1,10 @@
ikiwiki (2.51) UNRELEASED; urgency=low
* Improve toplevel parentlink to link directly to index.html when usedirs is
disabled.
-- Joey Hess <joeyh@debian.org> Sun, 15 Jun 2008 15:03:33 -0400
ikiwiki (2.50) unstable; urgency=low ikiwiki (2.50) unstable; urgency=low
* img: Support captions. * img: Support captions.