]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/blobdiff - IkiWiki/Plugin/parentlinks.pm
parentlinks: Add has_parentlinks template parameter to allow styling the toplevel...
[git.ikiwiki.info.git] / IkiWiki / Plugin / parentlinks.pm
index 866201e5ee1e3eace05d68d17af1ca28fd469543..b01d76f8089ee44e85bed1dc50e564b4e1dcdde3 100644 (file)
@@ -4,7 +4,7 @@ package IkiWiki::Plugin::parentlinks;
 
 use warnings;
 use strict;
 
 use warnings;
 use strict;
-use IkiWiki 2.00;
+use IkiWiki 3.00;
 
 sub import {
        hook(type => "parentlinks", id => "parentlinks", call => \&parentlinks);
 
 sub import {
        hook(type => "parentlinks", id => "parentlinks", call => \&parentlinks);
@@ -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));
        }
 }
 
        }
 }