comments: substitute commentsurl and atomcommentsurl for use in feeds

master
Simon McVittie 2008-12-21 17:15:49 +00:00
parent c42f174e65
commit d0d598e429
1 changed files with 18 additions and 0 deletions

View 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