2 # Ikiwiki parentlinks plugin.
3 package IkiWiki::Plugin::parentlinks;
10 hook(type => "pagetemplate", id => "parentlinks", call => \&pagetemplate);
13 sub parentlinks ($) { #{{{
18 my $title=$config{wikiname};
23 my @pagepath=(split("/", $page));
24 my $pagedepth=@pagepath;
25 foreach my $dir (@pagepath) {
26 next if $dir eq 'index';
28 $height=($pagedepth - $depth);
30 url => urlto($path, $page),
35 "height_$height" => 1,
38 $title=IkiWiki::pagetitle($dir);
44 sub pagetemplate (@) { #{{{
46 my $page=$params{page};
47 my $template=$params{template};
49 if ($template->query(name => "parentlinks")) {
50 $template->param(parentlinks => [parentlinks($page)]);