+sub pagetemplate (@) { #{{{
+ my %params=@_;
+ my $page=$params{page};
+ my $destpage=$params{destpage};
+ my $template=$params{template};
+
+ $template->param(tags => [
+ map {
+ link => htmllink($page, $destpage, tagpage($_))
+ }, sort keys %{$tags{$page}}
+ ]) if exists $tags{$page} && %{$tags{$page}} && $template->query(name => "tags");
+
+ if ($template->query(name => "categories")) {
+ # It's an rss/atom template. Add any categories.
+ if (exists $tags{$page} && %{$tags{$page}}) {
+ $template->param(categories => [map { category => $_ },
+ sort keys %{$tags{$page}}]);
+ }
+ }
+} # }}}
+