]> sipb.mit.edu Git - ikiwiki.git/blobdiff - IkiWiki/Plugin/parentlinks.pm
Merge branch 'master' into sipb
[ikiwiki.git] / IkiWiki / Plugin / parentlinks.pm
index 728bbc399fe8b50e247318158a57bd5c2facad96..bdf678069877b3c09bd29894d3f5d6b0353d2619 100644 (file)
@@ -32,10 +32,17 @@ sub parentlinks ($) {
 
        my @pagepath=(split("/", $page));
        my $pagedepth=@pagepath;
 
        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);
        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,
                push @ret, {
                        url => urlto(bestlink($page, $path), $page),
                        page => $title,
@@ -44,8 +51,6 @@ sub parentlinks ($) {
                        "depth_$depth" => 1,
                        "height_$height" => 1,
                };
                        "depth_$depth" => 1,
                        "height_$height" => 1,
                };
-               $path.="/".$dir;
-               $title=pagetitle($dir);
                $i++;
        }
        return @ret;
                $i++;
        }
        return @ret;