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);
27 my $title=$config{wikiname};
32 my @pagepath=(split("/", $page));
33 my $pagedepth=@pagepath;
35 # The last element in @pagepath is the page itself, so punt that
36 # (These are /parent/ links, after all.)
39 foreach my $dir (@pagepath) {
40 next if $dir eq 'index';
42 $height=($pagedepth - $depth);
44 $title=pagetitle($dir);
46 url => urlto($path, $page),
51 "height_$height" => 1,
58 sub pagetemplate (@) {
60 my $page=$params{page};
61 my $template=$params{template};
63 if ($template->query(name => "parentlinks")) {
64 $template->param(parentlinks => [parentlinks($page)]);