X-Git-Url: https://sipb.mit.edu/gitweb.cgi/ikiwiki.git/blobdiff_plain/4da6e94305c2c7f4adab057b362d9e58a7494439..ce7966a82cf8d0043a771a1a5b26e3a953e909b2:/IkiWiki/Plugin/parentlinks.pm diff --git a/IkiWiki/Plugin/parentlinks.pm b/IkiWiki/Plugin/parentlinks.pm index 728bbc399..bdf678069 100644 --- a/IkiWiki/Plugin/parentlinks.pm +++ b/IkiWiki/Plugin/parentlinks.pm @@ -32,10 +32,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(bestlink($page, $path), $page), page => $title, @@ -44,8 +51,6 @@ sub parentlinks ($) { "depth_$depth" => 1, "height_$height" => 1, }; - $path.="/".$dir; - $title=pagetitle($dir); $i++; } return @ret;