Skip to content

Commit

Permalink
Add stats page
Browse files Browse the repository at this point in the history
  • Loading branch information
johnpeart committed May 19, 2024
1 parent 22effb0 commit 837003a
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions pages/stats.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
layout: page
title: Stats
permalink: /stats/
---

{% assign years = "2020, 2021, 2022, 2023, 2024" | split: ", " | reverse %}

{% for year in years %}
{% assign year = year | date: "%Y" %}
<h2>{{ year }}</h2>
<section class="stats">
{% assign collections = "blogpost, weeknotes, now, note, list, photo, reply, share, music, manuals" | split: ", " %}
{% for collection in collections %}
{% assign count = 0 %}
{% for item in site[collection] %}
{% assign postYear = item.date | date: "%Y" %}
{% if postYear == year %}
{% assign count = count | plus: 1 %}
{% endif %}
{% endfor %}
{% if count > 0 %}
<dl class="stats--stat">
<dt class="stats--stat--type">{{ collection }}</dt>
<dd class="stats--stat--count">{{ count }}</dd>
</dl>
{% endif %}
{% endfor %}
</section>
{% endfor %}

0 comments on commit 837003a

Please sign in to comment.