X-Git-Url: https://sipb.mit.edu/gitweb.cgi/ikiwiki.git/blobdiff_plain/bb93fccf0690344aa77f9538a508959a6de09847..91e7a47acb74401dd817975734bb29963a8ba3a8:/IkiWiki/Plugin/parentlinks.pm diff --git a/IkiWiki/Plugin/parentlinks.pm b/IkiWiki/Plugin/parentlinks.pm index fb41e1c83..fa0508900 100644 --- a/IkiWiki/Plugin/parentlinks.pm +++ b/IkiWiki/Plugin/parentlinks.pm @@ -4,7 +4,7 @@ package IkiWiki::Plugin::parentlinks; use warnings; use strict; -use IkiWiki 2.00; +use IkiWiki 3.00; sub import { hook(type => "parentlinks", id => "parentlinks", call => \&parentlinks); @@ -31,10 +31,17 @@ sub parentlinks ($) { my @pagepath=(split("/", $page)); my $pagedepth=@pagepath; + + # The last element in @pagepath is the page itself, so punt that + # (These are /parent/ links, after all.) + pop @pagepath; + foreach my $dir (@pagepath) { next if $dir eq 'index'; $depth=$i; $height=($pagedepth - $depth); + $path.="/".$dir; + $title=pagetitle($dir); push @ret, { url => urlto($path, $page), page => $title, @@ -43,8 +50,6 @@ sub parentlinks ($) { "depth_$depth" => 1, "height_$height" => 1, }; - $path.="/".$dir; - $title=pagetitle($dir); $i++; } return @ret;