]> sipb.mit.edu Git - ikiwiki.git/commitdiff
po: added HOMEPAGEURL template variable, documented when to use it
authorintrigeri <intrigeri@boum.org>
Tue, 11 Nov 2008 14:27:39 +0000 (15:27 +0100)
committerintrigeri <intrigeri@boum.org>
Tue, 11 Nov 2008 14:27:39 +0000 (15:27 +0100)
Hopefully all links should now be consistent with the chosen linking behavior,
but who knows...

Signed-off-by: intrigeri <intrigeri@boum.org>
IkiWiki/Plugin/po.pm
doc/plugins/po.mdwn

index 42a125808addaa570f4157d2dfa2c089a7ecbfff..739564c6bb01b47a866bb180128c1d04ef8b3d21 100644 (file)
@@ -285,6 +285,9 @@ sub pagetemplate (@) { #{{{
        if ($template->query(name => "istranslatable")) {
                $template->param(istranslatable => istranslatable($page));
        }
+       if ($template->query(name => "HOMEPAGEURL")) {
+               $template->param(homepageurl => homepageurl($page));
+       }
        if ($template->query(name => "otherlanguages")) {
                $template->param(otherlanguages => [otherlanguagesloop($page)]);
                map add_depends($page, $_), (values %{otherlanguages($page)});
@@ -705,6 +708,11 @@ sub otherlanguagesloop ($) { #{{{
                } @ret;
 } #}}}
 
+sub homepageurl (;$) { #{{{
+       my $page=shift;
+
+       return urlto('', $page);
+} #}}}
 
 # ,----
 # | PageSpec's
index 2f359bb8389e00ca318978c69e445e37e288e4a4..d27b5af1d78509ca236c8d4a160c98342cceeb98 100644 (file)
@@ -129,6 +129,10 @@ Usage
 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
 display things only on translatable or translation pages.