aboutsummaryrefslogtreecommitdiff
path: root/IkiWiki/Plugin
diff options
context:
space:
mode:
authorJoey Hess <joey@gnu.kitenet.net>2008-12-19 13:55:41 -0500
committerJoey Hess <joey@gnu.kitenet.net>2008-12-19 13:55:41 -0500
commitf7fc062a12dd18cb153ede4d574fd792bc996218 (patch)
treeec59a51586fb0a6dbe57ad2cacf10a60827fd7d8 /IkiWiki/Plugin
parent2c06f5f27500bd5df5d5d62115cb936b8f9fb34b (diff)
downloadikiwiki-f7fc062a12dd18cb153ede4d574fd792bc996218.tar
ikiwiki-f7fc062a12dd18cb153ede4d574fd792bc996218.tar.gz
replace discussion links on pages with comments link
The thinking here is that having both a Discussion page and comments for the same page is redundant, and certianly not what you want if you enable comments for a page. At first I considered making configurable via pagespec what pages got discussion links. But that would mean testing a new pagespec for every page, and a redundant config setting to keep in sync. So intead, take a lead from my previous change to make inlined pages have a comments link, and change the discussion link at the top of regular pages to link to their comments. (Implementation is a bit optimised to avoid redundant pagespec checking.)
Diffstat (limited to 'IkiWiki/Plugin')
-rw-r--r--IkiWiki/Plugin/comments.pm7
1 files changed, 4 insertions, 3 deletions
diff --git a/IkiWiki/Plugin/comments.pm b/IkiWiki/Plugin/comments.pm
index 3b8752894..fd9f0acb4 100644
--- a/IkiWiki/Plugin/comments.pm
+++ b/IkiWiki/Plugin/comments.pm
@@ -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"),