Skip to content

Commit

Permalink
Merge pull request #443 from Soroosh/counts
Browse files Browse the repository at this point in the history
Add item counts to categories
  • Loading branch information
sylhare committed Jun 14, 2024
2 parents d5405b1 + 25b8cf1 commit bd6b54e
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 bd6b54e

Please sign in to comment.