comments: substitute commentsurl and atomcommentsurl for use in feeds
authorSimon McVittie <smcv@ http://smcv.pseudorandom.co.uk/>
Sun, 21 Dec 2008 17:15:49 +0000 (17:15 +0000)
committerSimon McVittie <smcv@ http://smcv.pseudorandom.co.uk/>
Sun, 21 Dec 2008 17:15:49 +0000 (17:15 +0000)
IkiWiki/Plugin/comments.pm

index 23e089761005f32319bf2697a6b27ba5b8f8a4ae..0ae9eefe320f2b634781375b8c57927844a8d2cc 100644 (file)
@@ -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