2 # Ikiwiki parentlinks plugin.
3 package IkiWiki::Plugin::parentlinks;
10 hook(type => "parentlinks", id => "parentlinks", call => \&parentlinks);
11 hook(type => "pagetemplate", id => "parentlinks", call => \&pagetemplate);
14 sub getsetup () { #{{{
22 sub parentlinks ($) { #{{{
27 my $title=$config{wikiname};
32 my @pagepath=(split("/", $page));
33 my $pagedepth=@pagepath;
34 foreach my $dir (@pagepath) {
35 next if $dir eq 'index';
37 $height=($pagedepth - $depth);
39 url => urlto($path, $page),
44 "height_$height" => 1,
47 $title=pagetitle($dir);
53 sub pagetemplate (@) { #{{{
55 my $page=$params{page};
56 my $template=$params{template};
58 if ($template->query(name => "parentlinks")) {
59 $template->param(parentlinks => [parentlinks($page)]);