- map { link => IkiWiki::htmllink($page, $destpage, $_) },
- @{$tags{$page}}
- ]) if exists $tags{$page} && @{$tags{$page}} && $template->query(name => "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}}]);
+ }
+ }