]> sipb.mit.edu Git - ikiwiki.git/blobdiff - IkiWiki/Plugin/parentlinks.pm
Merge branch 'master' into sipb
[ikiwiki.git] / IkiWiki / Plugin / parentlinks.pm
index fa0508900453523b59d41a3e0d04271ae836bf5b..bdf678069877b3c09bd29894d3f5d6b0353d2619 100644 (file)
@@ -16,6 +16,7 @@ sub getsetup () {
                plugin => {
                        safe => 1,
                        rebuild => 1,
+                       section => "core",
                },
 }
 
@@ -43,7 +44,7 @@ sub parentlinks ($) {
                $path.="/".$dir;
                $title=pagetitle($dir);
                push @ret, {
-                       url => urlto($path, $page),
+                       url => urlto(bestlink($page, $path), $page),
                        page => $title,
                        depth => $depth,
                        height => $height,
@@ -60,8 +61,11 @@ sub pagetemplate (@) {
         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));
        }
 }