From 88e355730b3996750c1f3d8a1eb45756305402ca Mon Sep 17 00:00:00 2001 From: Nathan McCarty Date: Fri, 7 Feb 2025 06:02:53 -0500 Subject: [PATCH] Sort tags alphabetically for consistent ordering --- lib/DB.rakumod | 2 +- lib/Render/Post.rakumod | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/DB.rakumod b/lib/DB.rakumod index c3c5426..dac655d 100644 --- a/lib/DB.rakumod +++ b/lib/DB.rakumod @@ -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; diff --git a/lib/Render/Post.rakumod b/lib/Render/Post.rakumod index 37fbd0b..826582e 100644 --- a/lib/Render/Post.rakumod +++ b/lib/Render/Post.rakumod @@ -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, [