- eval q{use URI};
- # The base url needs to be a full URL. If urlto returns relative,
- # force it absolute, using the same URL scheme used for the cgi.
- my $baseurl = URI->new_abs(urlto($params{page}), $cgi->url);
+ my $topurl = $config{url};
+ if (defined $cgi && ! $config{w3mmode} && ! $config{reverse_proxy}) {
+ $topurl = $cgi->url;
+ }
+
+ my $page="";
+ if (exists $params{page}) {
+ $page=delete $params{page};
+ $params{forcebaseurl}=urlto($page);
+ if (! $config{html5}) {
+ $params{forcebaseurl}=urlabs($params{forcebaseurl}, $topurl);
+ }
+ }
+ run_hooks(pagetemplate => sub {
+ shift->(
+ page => $page,
+ destpage => $page,
+ template => $template,
+ );
+ });
+ templateactions($template, "");