X-Git-Url: http://git.vanrenterghem.biz/git.ikiwiki.info.git/blobdiff_plain/523650d9c2b876152aaa9bc6c5d6363377ea7008..2cbf60a431d41b3cb0767f1c0fb1ecf50103bcb0:/IkiWiki/Plugin/parentlinks.pm?ds=inline

diff --git a/IkiWiki/Plugin/parentlinks.pm b/IkiWiki/Plugin/parentlinks.pm
index ebf1d449a..e678a057d 100644
--- a/IkiWiki/Plugin/parentlinks.pm
+++ b/IkiWiki/Plugin/parentlinks.pm
@@ -36,7 +36,7 @@ sub parentlinks ($) {
 		$depth=$i;
 		$height=($pagedepth - $depth);
 		push @ret, {
-			url => urlto($path, $page),
+			url => urlto(bestlink($page, $path), $page),
 			page => $title,
 			depth => $depth,
 			height => $height,
@@ -55,8 +55,11 @@ sub pagetemplate (@) {
         my $page=$params{page};
         my $template=$params{template};
 
-	if ($template->query(name => "parentlinks")) {
-		$template->param(parentlinks => [parentlinks($page)]);
+	if ($template->query(name => "parentlinks") ||
+ 	   $template->query(name => "has_parentlinks")) {
+		my @links=parentlinks($page);
+		$template->param(parentlinks => \@links);
+		$template->param(has_parentlinks => (@links > 0));
 	}
 }