X-Git-Url: http://git.vanrenterghem.biz/git.ikiwiki.info.git/blobdiff_plain/9747c47670064f206189eb3c36a8e7fcfe08e172..9a0b9bdc88c1b47c14ad0b587c93bbac400e61ac:/IkiWiki/Plugin/comments.pm diff --git a/IkiWiki/Plugin/comments.pm b/IkiWiki/Plugin/comments.pm index 6340fc2cb..5bcf4a981 100644 --- a/IkiWiki/Plugin/comments.pm +++ b/IkiWiki/Plugin/comments.pm @@ -38,6 +38,7 @@ sub getsetup () { plugin => { safe => 1, rebuild => 1, + section => "web", }, comments_pagespec => { type => 'pagespec', @@ -171,9 +172,8 @@ sub preprocess { else { $commentauthorurl = IkiWiki::cgiurl( do => 'goto', - page => (length $config{userdir} - ? "$config{userdir}/$commentuser" - : "$commentuser")); + page => IkiWiki::userpage($commentuser) + ); $commentauthor = $commentuser; } @@ -224,7 +224,7 @@ sub preprocess { $pagestate{$page}{meta}{title} = $params{subject}; } - if ($params{page} =~ m/\/(\Q$config{comments_pagename}\E\d+)$/) { + if ($params{page} =~ m/\/\Q$config{comments_pagename}\E\d+_/) { $pagestate{$page}{meta}{permalink} = urlto(IkiWiki::dirname($params{page}), undef, 1). "#".page_to_id($params{page}); } @@ -742,28 +742,24 @@ sub pagetemplate (@) { } } - if ($template->query(name => 'commentsurl')) { - if ($shown) { + if ($shown) { + if ($template->query(name => 'commentsurl')) { $template->param(commentsurl => urlto($page, undef, 1).'#comments'); } - } - if ($template->query(name => 'atomcommentsurl') && $config{usedirs}) { - if ($shown) { + if ($template->query(name => 'atomcommentsurl') && $config{usedirs}) { # 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 # would have to update whenever comments of any inlines # page are added, which is not currently done. - if ($shown) { + if ($template->query(name => 'commentslink')) { $template->param(commentslink => htmllink($page, $params{destpage}, $page, linktext => gettext("Comments"),