minor refactor/optimisation

master
Joey Hess 2010-02-14 18:09:28 -05:00
parent f1183cbf0c
commit 9a0b9bdc88
1 changed files with 4 additions and 8 deletions

View File

@ -742,28 +742,24 @@ sub pagetemplate (@) {
} }
} }
if ($template->query(name => 'commentsurl')) { if ($shown) {
if ($shown) { if ($template->query(name => 'commentsurl')) {
$template->param(commentsurl => $template->param(commentsurl =>
urlto($page, undef, 1).'#comments'); urlto($page, undef, 1).'#comments');
} }
}
if ($template->query(name => 'atomcommentsurl') && $config{usedirs}) { if ($template->query(name => 'atomcommentsurl') && $config{usedirs}) {
if ($shown) {
# This will 404 until there are some comments, but I # This will 404 until there are some comments, but I
# think that's probably OK... # think that's probably OK...
$template->param(atomcommentsurl => $template->param(atomcommentsurl =>
urlto($page, undef, 1).'comments.atom'); urlto($page, undef, 1).'comments.atom');
} }
}
if ($template->query(name => 'commentslink')) {
# XXX Would be nice to say how many comments there are in # XXX Would be nice to say how many comments there are in
# the link. But, to update the number, blog pages # the link. But, to update the number, blog pages
# would have to update whenever comments of any inlines # would have to update whenever comments of any inlines
# page are added, which is not currently done. # page are added, which is not currently done.
if ($shown) { if ($template->query(name => 'commentslink')) {
$template->param(commentslink => $template->param(commentslink =>
htmllink($page, $params{destpage}, $page, htmllink($page, $params{destpage}, $page,
linktext => gettext("Comments"), linktext => gettext("Comments"),