summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon McVittie <smcv@ http://smcv.pseudorandom.co.uk/>2008-12-21 15:23:59 +0000
committerSimon McVittie <smcv@ http://smcv.pseudorandom.co.uk/>2008-12-21 15:23:59 +0000
commit0844bd0b1567404243d95e616d3c7526e922822d (patch)
treeb0029810a0a5ceadbaa712f7d582f22c183c96fe
parent95b3bbbf7c786cc9e1dd7d7925ac75a0f525affd (diff)
beautify_urlpath: add ./ before checking for /index.html
This fixes a bug: when a page links to its own #comments anchor you would get a link like "index.html#comments" rather than "./#comments".
-rw-r--r--IkiWiki.pm8
1 files changed, 4 insertions, 4 deletions
diff --git a/IkiWiki.pm b/IkiWiki.pm
index 47116089b..97c835cf6 100644
--- a/IkiWiki.pm
+++ b/IkiWiki.pm
@@ -949,16 +949,16 @@ sub formattime ($;$) {
sub beautify_urlpath ($) {
my $url=shift;
- if ($config{usedirs}) {
- $url =~ s!/index.$config{htmlext}$!/!;
- }
-
# Ensure url is not an empty link, and if necessary,
# add ./ to avoid colon confusion.
if ($url !~ /^\// && $url !~ /^\.\.\//) {
$url="./$url";
}
+ if ($config{usedirs}) {
+ $url =~ s!/index.$config{htmlext}$!/!;
+ }
+
return $url;
}