]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/blobdiff - IkiWiki/Plugin/comments.pm
replace discussion links on pages with comments link
[git.ikiwiki.info.git] / IkiWiki / Plugin / comments.pm
index 3b87528941e4b6ffd8467b70e0d265400b6dd559..fd9f0acb48fc54a6a27d2f60a5b8f2b5940a687d 100644 (file)
@@ -529,10 +529,11 @@ sub pagetemplate (@) {
 
        my $page = $params{page};
        my $template = $params{template};
+       my $shown = ($template->query(name => 'commentslink') ||
+                    $template->query(name => 'comments')) &&
+                   commentsshown($page);
 
        if ($template->query(name => 'comments')) {
-               my $shown = commentsshown($page);
-
                my $comments = undef;
                if ($shown) {
                        $comments = IkiWiki::preprocess_inline(
@@ -563,7 +564,7 @@ sub pagetemplate (@) {
                # the link. But, to update the number, blog pages
                # would have to update whenever comments of any inlines
                # page are added, which is not currently done.
-               if (commentsshown($page)) {
+               if ($shown) {
                        $template->param(commentslink =>
                                htmllink($page, $params{destpage}, $page,
                                        linktext => gettext("Comments"),