Sort tags alphabetically for consistent ordering

This commit is contained in:
Nathan McCarty 2025-02-07 06:02:53 -05:00
parent 946ce908e9
commit 88e355730b
2 changed files with 2 additions and 2 deletions

View file

@ -106,7 +106,7 @@ class PostDB {
$about-path.unlink if $about-path.l;
$by-id.add("{$!meta.about-id}.html").symlink: $about-path;
# Generate the tags pages
my @tags = %!posts.values.map(*.tags).flat.unique;
my @tags = %!posts.values.map(*.tags).flat.unique.sort;
$out-dir.add('tags.html').spurt: $config.generate-tags-page(self, @tags);
my $tags-dir = $out-dir.add('tags/');
mkdir $tags-dir unless $tags-dir.e;

View file

@ -68,7 +68,7 @@ sub post-tag(Str:D $tag) is export {
}
sub post-tags(Post:D $post) is export {
my @tags = $post.tags;
my @tags = $post.tags.sort;
if @tags {
@tags.=map(*.&post-tag);
div :class<post-tags>, [