summaryrefslogtreecommitdiff
path: root/IkiWiki
diff options
context:
space:
mode:
authorintrigeri <intrigeri@boum.org>2009-06-03 18:30:00 +0200
committerintrigeri <intrigeri@boum.org>2009-06-03 18:30:00 +0200
commit091f11be76991c3975c74d261ab4a065845ba8aa (patch)
tree34f549245cca5c149a0eb0101c7b3eb75e123e55 /IkiWiki
parent2ed033a4aac0d603c375294bdb19f5b74519f389 (diff)
po: better discussion link logic
Signed-off-by: intrigeri <intrigeri@boum.org>
Diffstat (limited to 'IkiWiki')
-rw-r--r--IkiWiki/Plugin/po.pm28
1 files changed, 13 insertions, 15 deletions
diff --git a/IkiWiki/Plugin/po.pm b/IkiWiki/Plugin/po.pm
index d26c4ab4e..cdb9271e4 100644
--- a/IkiWiki/Plugin/po.pm
+++ b/IkiWiki/Plugin/po.pm
@@ -260,22 +260,20 @@ sub pagetemplate (@) {
$template->param(otherlanguages => [otherlanguagesloop($page)]);
map add_depends($page, $_), (values %{otherlanguages($page)});
}
- # Rely on IkiWiki::Render's genpage() to decide wether
- # a discussion link should appear on $page; this is not
- # totally accurate, though: some broken links may be generated
- # when cgiurl is disabled.
- # This compromise avoids some code duplication, and will probably
- # prevent future breakage when ikiwiki internals change.
- # Known limitations are preferred to future random bugs.
- if ($template->param('discussionlink') && istranslation($page)) {
- $template->param('discussionlink' => htmllink(
- $page,
- $destpage,
- $masterpage . '/' . gettext("Discussion"),
- noimageinline => 1,
- forcesubpage => 0,
- linktext => gettext("Discussion"),
+ if ($config{discussion} && istranslation($page)) {
+ my $discussionlink=gettext("discussion");
+ if ($page !~ /.*\/\Q$discussionlink\E$/i &&
+ (length $config{cgiurl} ||
+ exists $links{$masterpage."/".$discussionlink})) {
+ $template->param('discussionlink' => htmllink(
+ $page,
+ $destpage,
+ $masterpage . '/' . gettext("Discussion"),
+ noimageinline => 1,
+ forcesubpage => 0,
+ linktext => gettext("Discussion"),
));
+ }
}
# Remove broken parentlink to ./index.html on home page's translations.
# It works because this hook has the "last" parameter set, to ensure it