fix: Show only categories where published articles count > 0 (#6567)

This commit is contained in:
Pranav Raj S
2023-02-28 21:32:54 -08:00
committed by GitHub
parent 0a993978ba
commit e5090fcdc7

View File

@@ -1,7 +1,7 @@
<%= render "public/api/v1/portals/hero", portal: @portal %>
<div class="max-w-5xl w-full flex-grow mx-auto py-8 px-4">
<div class="grid grid-cols-1 lg:grid-cols-2 gap-x-32 gap-y-0 lg:gap-y-12">
<% @portal.categories.where(locale: @locale).each do |category| %>
<% @portal.categories.where(locale: @locale).joins(:articles).where(articles:{ status: :published }).group('categories.id').each do |category| %>
<%= render "public/api/v1/portals/category-block", category: category, portal: @portal %>
<% end %>
</div>