summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon McVittie <smcv@ http://smcv.pseudorandom.co.uk/>2008-12-21 17:15:49 +0000
committerSimon McVittie <smcv@ http://smcv.pseudorandom.co.uk/>2008-12-21 17:15:49 +0000
commitd0d598e429313756192927418757e2869004049e (patch)
tree4e811562b5fab107e477353d782ae2d9c6aafc17
parentc42f174e655526bfaace70b31f9cbc79e2e1be9a (diff)
comments: substitute commentsurl and atomcommentsurl for use in feeds
-rw-r--r--IkiWiki/Plugin/comments.pm18
1 files changed, 18 insertions, 0 deletions
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