]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/blobdiff - IkiWiki/Plugin/parentlinks.pm
Comments (maybe not so helpful - sorry)
[git.ikiwiki.info.git] / IkiWiki / Plugin / parentlinks.pm
index ebf1d449ae50522dac1174176810c4bd3db99799..e678a057d2bdf9a03aa741f8bd019f39e8667bca 100644 (file)
@@ -36,7 +36,7 @@ sub parentlinks ($) {
                $depth=$i;
                $height=($pagedepth - $depth);
                push @ret, {
                $depth=$i;
                $height=($pagedepth - $depth);
                push @ret, {
-                       url => urlto($path, $page),
+                       url => urlto(bestlink($page, $path), $page),
                        page => $title,
                        depth => $depth,
                        height => $height,
                        page => $title,
                        depth => $depth,
                        height => $height,
@@ -55,8 +55,11 @@ sub pagetemplate (@) {
         my $page=$params{page};
         my $template=$params{template};
 
         my $page=$params{page};
         my $template=$params{template};
 
-       if ($template->query(name => "parentlinks")) {
-               $template->param(parentlinks => [parentlinks($page)]);
+       if ($template->query(name => "parentlinks") ||
+          $template->query(name => "has_parentlinks")) {
+               my @links=parentlinks($page);
+               $template->param(parentlinks => \@links);
+               $template->param(has_parentlinks => (@links > 0));
        }
 }
 
        }
 }