Fix tags page

This commit is contained in:
2023-11-05 16:45:36 +11:00
parent 55cd087cd2
commit acd4a18f44
3 changed files with 7 additions and 5 deletions

View File

@@ -8,6 +8,7 @@ module Adamantium
def list
tags
.order(Sequel.function(:lower, :label))
.combine(:posts)
.to_a
end
end

View File

@@ -3,13 +3,13 @@
div class="mb-12 prose dark:prose-invert max-w-prose mx-auto text-gray-800 dark:text-gray-200 columns-2"
h1 Tags
- tag_groups.each do |group, tags|
- tag_groups.each do |tags|
div class="break-inside-avoid-column"
h3 class="border-b-2" class="text-xl mt-6 mb-2 font-bold text-gray-800 dark:text-gray-200" = group.upcase
h3 class="border-b-2" class="text-xl mt-6 mb-2 font-bold text-gray-800 dark:text-gray-200" = tags[:group].upcase
- tags.each do |post_tag|
- tags[:tags].each do |post_tag|
div
a class="p-category no-underline rounded p-1 mr-1 u-url text-gray-600 dark:text-indigo-400 hover:text-gray-900" href="/tagged/#{post_tag.slug}"
= post_tag.label
a class="p-category no-underline rounded p-1 mr-1 u-url text-gray-600 dark:text-indigo-400 hover:text-indigo-200" href="/tagged/#{post_tag[:tag].slug}"
= "#{post_tag[:tag].label} (#{post_tag[:count]})"
div class="max-w-screen-md mx-auto border-t border-solid border-gray-200 dark:border-gray-600"

View File

@@ -12,6 +12,7 @@ module Adamantium
/[a-z]/.match?(grouper) ? grouper : "#"
}
.sort
.map { |group, tags| {group: group, tags: tags.map {|tag| {tag: tag, count: tag.posts.count} }} }
end
end
end