X-Git-Url: https://sipb.mit.edu/gitweb.cgi/ikiwiki.git/blobdiff_plain/e1c0576029f2f87b77887fe499c700ca8974ae9b..2a0d91af2f8f6ca3142c8f73ea6869e7a914bb30:/IkiWiki/Plugin/tag.pm diff --git a/IkiWiki/Plugin/tag.pm b/IkiWiki/Plugin/tag.pm index 29d1d030a..7ab271622 100644 --- a/IkiWiki/Plugin/tag.pm +++ b/IkiWiki/Plugin/tag.pm @@ -40,10 +40,10 @@ sub preprocess (@) { #{{{ my $page = $params{page}; delete $params{page}; delete $params{destpage}; + delete $params{preview}; - $tags{$page} = []; foreach my $tag (keys %params) { - push @{$tags{$page}}, $tag; + $tags{$page}{$tag}=1; # hidden WikiLink push @{$links{$page}}, tagpage($tag); } @@ -60,13 +60,14 @@ sub pagetemplate (@) { #{{{ $template->param(tags => [ map { link => htmllink($page, $destpage, tagpage($_)) - }, @{$tags{$page}} - ]) if exists $tags{$page} && @{$tags{$page}} && $template->query(name => "tags"); + }, 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 => $_ }, @{$tags{$page}}]); + if (exists $tags{$page} && %{$tags{$page}}) { + $template->param(categories => [map { category => $_ }, + sort keys %{$tags{$page}}]); } } } # }}}