hook(type => "needsbuild", id => "po", call => \&needsbuild);
hook(type => "filter", id => "po", call => \&filter);
hook(type => "htmlize", id => "po", call => \&htmlize);
- hook(type => "pagetemplate", id => "po", call => \&pagetemplate);
+ hook(type => "pagetemplate", id => "po", call => \&pagetemplate, last => 1);
hook(type => "editcontent", id => "po", call => \&editcontent);
inject(name => "IkiWiki::bestlink", call => \&mybestlink);
inject(name => "IkiWiki::beautify_urlpath", call => \&mybeautify_urlpath);
sub pagetemplate (@) { #{{{
my %params=@_;
- my $page=$params{page};
- my $destpage=$params{destpage};
- my $template=$params{template};
+ my $page=$params{page};
+ my $destpage=$params{destpage};
+ my $template=$params{template};
+ my ($masterpage, $lang) = ($page =~ /(.*)[.]([a-z]{2})$/) if istranslation($page);
if (istranslation($page) && $template->query(name => "percenttranslated")) {
$template->param(percenttranslated => percenttranslated($page));
}
}
elsif (istranslation($page)) {
- my ($masterpage, $curlang) = ($page =~ /(.*)[.]([a-z]{2})$/);
add_depends($page, $masterpage);
foreach my $translation (values %{$translations{$masterpage}}) {
add_depends($page, $translation);
# prevent future breakage when ikiwiki internals change.
# Known limitations are preferred to future random bugs.
if ($template->param('discussionlink') && istranslation($page)) {
- my ($masterpage, $lang) = ($page =~ /(.*)[.]([a-z]{2})$/);
$template->param('discussionlink' => htmllink(
$page,
$destpage,
linktext => gettext("Discussion"),
));
}
+ # remove broken parentlink to ./index.html on home page's translations
+ if ($template->param('parentlinks')
+ && istranslation($page)
+ && $masterpage eq "index") {
+ $template->param('parentlinks' => []);
+ }
} # }}}
sub editcontent () { #{{{
Which configuration settings are safe enough for websetup?
-### parentlinks
-
-When the wiki home page is translatable, the parentlinks plugin sets
-`./index.html` as its translations' single parent link. Ideally, the
-home page's translations should get no parent link at all, just like
-the version written in the master language.
-
### backlinks
If a given translatable `sourcepage.mdwn` links to \[[destpage]],