po: added HOMEPAGEURL template variable, documented when to use it

Hopefully all links should now be consistent with the chosen linking behavior,
but who knows...

Signed-off-by: intrigeri <intrigeri@boum.org>
master
intrigeri 2008-11-11 15:27:39 +01:00
parent 18331e9261
commit 43a1d36378
2 changed files with 12 additions and 0 deletions

View File

@ -285,6 +285,9 @@ sub pagetemplate (@) { #{{{
if ($template->query(name => "istranslatable")) { if ($template->query(name => "istranslatable")) {
$template->param(istranslatable => istranslatable($page)); $template->param(istranslatable => istranslatable($page));
} }
if ($template->query(name => "HOMEPAGEURL")) {
$template->param(homepageurl => homepageurl($page));
}
if ($template->query(name => "otherlanguages")) { if ($template->query(name => "otherlanguages")) {
$template->param(otherlanguages => [otherlanguagesloop($page)]); $template->param(otherlanguages => [otherlanguagesloop($page)]);
map add_depends($page, $_), (values %{otherlanguages($page)}); map add_depends($page, $_), (values %{otherlanguages($page)});
@ -705,6 +708,11 @@ sub otherlanguagesloop ($) { #{{{
} @ret; } @ret;
} #}}} } #}}}
sub homepageurl (;$) { #{{{
my $page=shift;
return urlto('', $page);
} #}}}
# ,---- # ,----
# | PageSpec's # | PageSpec's

View File

@ -129,6 +129,10 @@ Usage
Templates Templates
--------- ---------
When `po_link_to` is not set to `negotiated`, one should replace some
occurrences of `BASEURL` with `HOMEPAGEURL` to get correct links to
the wiki homepage.
The `ISTRANSLATION` and `ISTRANSLATABLE` variables can be used to The `ISTRANSLATION` and `ISTRANSLATABLE` variables can be used to
display things only on translatable or translation pages. display things only on translatable or translation pages.