From: Simon McVittie Date: Sun, 21 Dec 2008 17:15:49 +0000 (+0000) Subject: comments: substitute commentsurl and atomcommentsurl for use in feeds X-Git-Url: https://sipb.mit.edu/gitweb.cgi/ikiwiki.git/commitdiff_plain/d0d598e429313756192927418757e2869004049e comments: substitute commentsurl and atomcommentsurl for use in feeds --- diff --git a/IkiWiki/Plugin/comments.pm b/IkiWiki/Plugin/comments.pm index 23e089761..0ae9eefe3 100644 --- a/IkiWiki/Plugin/comments.pm +++ b/IkiWiki/Plugin/comments.pm @@ -531,6 +531,8 @@ sub pagetemplate (@) { my $page = $params{page}; my $template = $params{template}; my $shown = ($template->query(name => 'commentslink') || + $template->query(name => 'commentsurl') || + $template->query(name => 'atomcommentsurl') || $template->query(name => 'comments')) && commentsshown($page); @@ -560,6 +562,22 @@ sub pagetemplate (@) { } } + if ($template->query(name => 'commentsurl')) { + if ($shown) { + $template->param(commentsurl => + urlto($page, undef, 1).'#comments'); + } + } + + if ($template->query(name => 'atomcommentsurl') && $config{usedirs}) { + if ($shown) { + # This will 404 until there are some comments, but I + # think that's probably OK... + $template->param(atomcommentsurl => + urlto($page, undef, 1).'comments.atom'); + } + } + if ($template->query(name => 'commentslink')) { # XXX Would be nice to say how many comments there are in # the link. But, to update the number, blog pages