* Fix bestlink to use pagecase for pages in userdir, to support pages
[ikiwiki.git] / IkiWiki.pm
index 73280abf1b13b0f3d56e3c71657ac401da061cc6..212b0de08e050eded0c1e42af53a03dd4250d2a9 100644 (file)
@@ -362,8 +362,14 @@ sub bestlink ($$) { #{{{
                }
        } while $cwd=~s!/?[^/]+$!!;
 
                }
        } while $cwd=~s!/?[^/]+$!!;
 
-       if (length $config{userdir} && exists $links{"$config{userdir}/".lc($link)}) {
-               return "$config{userdir}/".lc($link);
+       if (length $config{userdir}) {
+               my $l = "$config{userdir}/".lc($link);
+               if (exists $links{$l}) {
+                       return $l;
+               }
+               elsif (exists $pagecase{lc $l}) {
+                       return $pagecase{lc $l};
+               }
        }
 
        #print STDERR "warning: page $page, broken link: $link\n";
        }
 
        #print STDERR "warning: page $page, broken link: $link\n";