]> sipb.mit.edu Git - ikiwiki.git/blobdiff - IkiWiki/Plugin/parentlinks.pm
Merge commit 'f8880cb670b0d1169559d04602fc543b1a6a061e' into sipb
[ikiwiki.git] / IkiWiki / Plugin / parentlinks.pm
index bdf678069877b3c09bd29894d3f5d6b0353d2619..d06954a4f344b00a6b9b7341d2ad214515a8e600 100644 (file)
@@ -23,6 +23,14 @@ sub getsetup () {
 sub parentlinks ($) {
        my $page=shift;
 
 sub parentlinks ($) {
        my $page=shift;
 
+       if (! length $page) {
+               # dynamic page
+               return {
+                       url => $config{url},
+                       page => $config{wikiname},
+               };
+       }
+
        my @ret;
        my $path="";
        my $title=$config{wikiname};
        my @ret;
        my $path="";
        my $title=$config{wikiname};
@@ -58,12 +66,11 @@ sub parentlinks ($) {
 
 sub pagetemplate (@) {
        my %params=@_;
 
 sub pagetemplate (@) {
        my %params=@_;
-        my $page=$params{page};
         my $template=$params{template};
 
        if ($template->query(name => "parentlinks") ||
           $template->query(name => "has_parentlinks")) {
         my $template=$params{template};
 
        if ($template->query(name => "parentlinks") ||
           $template->query(name => "has_parentlinks")) {
-               my @links=parentlinks($page);
+               my @links=parentlinks($params{page});
                $template->param(parentlinks => \@links);
                $template->param(has_parentlinks => (@links > 0));
        }
                $template->param(parentlinks => \@links);
                $template->param(has_parentlinks => (@links > 0));
        }