Skip to content

Commit

Permalink
Add item counts to categories
Browse files Browse the repository at this point in the history
  • Loading branch information
Soroosh committed Jun 13, 2024
1 parent d5405b1 commit 25b8cf1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
9 changes: 7 additions & 2 deletions _layouts/categories.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ layout: page
{% for category in site.categories %}
<a href="#{{ category | first | cgi_escape }}" class="category-anchor">
<li>
{{ category | first }}
{{ category | first }}
<!-- {{ category | last | size | times: 100 | divided_by: site.tags.size | plus: 50 | divided_by: 100.0 }} -->
<!-- <span class="category-number">{{ category | last | size }}</span> -->
</li>
Expand All @@ -20,7 +20,12 @@ layout: page
{% for category in site.categories %}
<div class="category-group">
{% capture group %}{{ category | first }}{% endcapture %}
<h4 id="{{ group }}" class="title">{{ group }}</h4>
<h4 id="{{ group }}" class="title">
{{ group }}
{% if page.showCounts %}
({{site.categories[group].size}})
{% endif %}
</h4>
<div class="items">
{% for post in site.categories[group] %}
<a href="{{ post.url | relative_url }}" class="category-post-link">
Expand Down
1 change: 1 addition & 0 deletions pages/categories.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ title: Categories
permalink: /categories/
hide: true
excluded: true
showCounts: false
---

0 comments on commit 25b8cf1

Please sign in to comment.