From d7c40d4dbe9cbdcd3ff499e4588d4cc92ed8ea48 Mon Sep 17 00:00:00 2001 From: Alex Schroeder Date: Tue, 18 Mar 2014 13:01:27 +0100 Subject: [PATCH] Fix dead comment links If the comment page does not exist, the static copy contains an anchor element with no href attribute. Better avoid this situation. --- modules/static-copy.pl | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/modules/static-copy.pl b/modules/static-copy.pl index 08cbb199..b8d45483 100644 --- a/modules/static-copy.pl +++ b/modules/static-copy.pl @@ -60,6 +60,8 @@ sub StaticWriteFiles { my $html = GetParam('html', 0); local *ScriptLink = *StaticScriptLink; local *GetDownloadLink = *StaticGetDownloadLink; + # get rid of subscribe link in the footer by mail.pl + local *GetCommentForm = *MailOldGetCommentForm if defined &MailNewGetCommentForm; foreach my $id (AllPagesList()) { if ($StaticAlways > 1 or $html @@ -208,7 +210,8 @@ EOT print F $q->div({-class=>'content'}, PageHtml($id)); # this reopens the page currently open # footer my $links = ''; - if ($OpenPageName !~ /^$CommentsPrefix/) { # fails if $CommentsPrefix is empty! + if ($OpenPageName !~ /^$CommentsPrefix/ # fails if $CommentsPrefix is empty! + and $IndexHash{$CommentsPrefix . $OpenPageName}) { $links .= ScriptLink(UrlEncode($CommentsPrefix . $OpenPageName), T('Comments on this page')); }