diff options
author | Simon McVittie <smcv@ http://smcv.pseudorandom.co.uk/> | 2008-12-21 17:15:49 +0000 |
---|---|---|
committer | Simon McVittie <smcv@ http://smcv.pseudorandom.co.uk/> | 2008-12-21 17:15:49 +0000 |
commit | d0d598e429313756192927418757e2869004049e (patch) | |
tree | 4e811562b5fab107e477353d782ae2d9c6aafc17 | |
parent | c42f174e655526bfaace70b31f9cbc79e2e1be9a (diff) |
comments: substitute commentsurl and atomcommentsurl for use in feeds
-rw-r--r-- | IkiWiki/Plugin/comments.pm | 18 |
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 |