]> sipb.mit.edu Git - ikiwiki.git/blobdiff - IkiWiki/Plugin/parentlinks.pm
Don't show top level breadcrumb
[ikiwiki.git] / IkiWiki / Plugin / parentlinks.pm
index 4525145d6968d9a55e5dd6c2cc2bef360f188ae9..f172151bd2b1e21af3d0ff421f1622cda94c9bc9 100644 (file)
@@ -4,22 +4,22 @@ package IkiWiki::Plugin::parentlinks;
 
 use warnings;
 use strict;
-use IkiWiki 2.00;
+use IkiWiki 3.00;
 
-sub import { #{{{
+sub import {
        hook(type => "parentlinks", id => "parentlinks", call => \&parentlinks);
        hook(type => "pagetemplate", id => "parentlinks", call => \&pagetemplate);
-} # }}}
+}
 
-sub getsetup () { #{{{
+sub getsetup () {
        return 
                plugin => {
                        safe => 1,
                        rebuild => 1,
                },
-} #}}}
+}
 
-sub parentlinks ($) { #{{{
+sub parentlinks ($) {
        my $page=shift;
 
        my @ret;
@@ -35,6 +35,8 @@ sub parentlinks ($) { #{{{
                next if $dir eq 'index';
                $depth=$i;
                $height=($pagedepth - $depth);
+               $path.="/".$dir;
+               $title=pagetitle($dir);
                push @ret, {
                        url => urlto($path, $page),
                        page => $title,
@@ -43,14 +45,12 @@ sub parentlinks ($) { #{{{
                        "depth_$depth" => 1,
                        "height_$height" => 1,
                };
-               $path.="/".$dir;
-               $title=IkiWiki::pagetitle($dir);
                $i++;
        }
        return @ret;
-} #}}}
+}
 
-sub pagetemplate (@) { #{{{
+sub pagetemplate (@) {
        my %params=@_;
         my $page=$params{page};
         my $template=$params{template};
@@ -58,6 +58,6 @@ sub pagetemplate (@) { #{{{
        if ($template->query(name => "parentlinks")) {
                $template->param(parentlinks => [parentlinks($page)]);
        }
-} # }}}
+}
 
 1