]> sipb.mit.edu Git - ikiwiki.git/blobdiff - IkiWiki/Plugin/parentlinks.pm
Group related plugins into sections in the setup file, and drop unused rcs plugins...
[ikiwiki.git] / IkiWiki / Plugin / parentlinks.pm
index ebf1d449ae50522dac1174176810c4bd3db99799..728bbc399fe8b50e247318158a57bd5c2facad96 100644 (file)
@@ -16,6 +16,7 @@ sub getsetup () {
                plugin => {
                        safe => 1,
                        rebuild => 1,
+                       section => "core",
                },
 }
 
@@ -36,7 +37,7 @@ sub parentlinks ($) {
                $depth=$i;
                $height=($pagedepth - $depth);
                push @ret, {
-                       url => urlto($path, $page),
+                       url => urlto(bestlink($page, $path), $page),
                        page => $title,
                        depth => $depth,
                        height => $height,
@@ -55,8 +56,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));
        }
 }