@@ -6,14 +6,36 @@ permalink: /archive/
66
77# 📚 Devlog Archive
88
9- All my devlog entries, organized by month.
9+ All my devlog entries, organized by year and month.
10+
11+ <div class =" archive-controls " >
12+ <button id =" expand-all " class =" archive-btn " aria-label =" Expand all years " >Expand All</button >
13+ <button id =" collapse-all " class =" archive-btn " aria-label =" Collapse all years " >Collapse All</button >
14+ <input type =" text " id =" archive-search " class =" archive-search " placeholder =" Search entries... " aria-label =" Search archive entries " >
15+ </div >
1016
1117---
1218
1319{% assign logs = site.pages | where_exp:"p","p.url contains '/logs/'" | sort: "url" | reverse %}
20+
21+ {% comment %} First pass: count entries per year and month {% endcomment %}
22+ {% assign year_counts = "" | split: "," %}
23+ {% assign month_counts = "" | split: "," %}
24+ {% for p in logs %}
25+ {% assign parts = p.url | split:'/' %}
26+ {% assign date_str = parts[ 2] %}
27+ {% assign year = date_str | slice:0,4 %}
28+ {% assign month = date_str | slice:0,7 %}
29+ {% assign year_counts = year_counts | push: year %}
30+ {% assign month_counts = month_counts | push: month %}
31+ {% endfor %}
32+
1433{% assign current_year = "" %}
1534{% assign current_month = "" %}
35+ {% assign year_count = 0 %}
36+ {% assign month_count = 0 %}
1637
38+ <div id =" archive-container " >
1739{% for p in logs %}
1840 {% assign parts = p.url | split:'/' %}
1941 {% assign date_str = parts[ 2] %}
@@ -25,22 +47,53 @@ All my devlog entries, organized by month.
2547 {%- if current_month != "" -%}</ul ></div >{%- endif -%}
2648 </details >
2749 {%- endif -%}
28- <details class =" archive-year " >
29- <summary >{{ year }}</summary >
50+
51+ {% comment %} Count entries for this year {% endcomment %}
52+ {% assign year_count = 0 %}
53+ {% for y in year_counts %}
54+ {% if y == year %}
55+ {% assign year_count = year_count | plus: 1 %}
56+ {% endif %}
57+ {% endfor %}
58+
59+ <details class =" archive-year " data-year =" {{ year }} " >
60+ <summary aria-expanded =" false " >
61+ <span class =" year-label " >{{ year }}</span >
62+ <span class =" year-count " >({{ year_count }})</span >
63+ </summary >
3064 {%- assign current_year = year -%}
3165 {%- assign current_month = "" -%}
66+ {%- assign month_count = 0 -%}
3267 {%- endif -%}
3368
3469 {%- if month != current_month -%}
3570 {%- if current_month != "" -%}</ul ></div >{%- endif -%}
36- <div class =" archive-month " >
37- <h3 >{{ month }}</h3 >
71+
72+ {% comment %} Count entries for this month {% endcomment %}
73+ {% assign month_count = 0 %}
74+ {% for m in month_counts %}
75+ {% if m == month %}
76+ {% assign month_count = month_count | plus: 1 %}
77+ {% endif %}
78+ {% endfor %}
79+
80+ <div class =" archive-month " data-month =" {{ month }} " >
81+ <h2 class =" archive-month-heading " >{{ month }} <span class =" month-count " >({{ month_count }})</span ></h2 >
3882 <ul >
3983 {%- assign current_month = month -%}
4084 {%- endif -%}
4185
42- <li ><a href =" {{ p.url | relative_url }} " >{{ date_str }} — {{ p.title | default: "Devlog" }}</a ></li >
86+ {% assign excerpt = p.content | strip_html | strip_newlines | truncatewords: 15 %}
87+ <li class =" archive-entry " data-date =" {{ date_str }} " data-title =" {{ p.title | default: 'Devlog' | downcase }} " >
88+ <a href="{{ p.url | relative_url }}" class="archive-link" data-excerpt="{{ excerpt | escape }}">
89+ <span class="archive-date">{{ date_str }}</span>
90+ <span class="archive-title"> — {{ p.title | default: "Devlog" }}</span>
91+ </a>
92+ </li >
4393{% endfor %}
4494
4595{% if current_month != "" %}</ul ></div >{% endif %}
46- {% if current_year != "" %}</details >{% endif %}
96+ {% if current_year != "" %}</details >{% endif %}
97+ </div >
98+
99+ <script src =" {{ '/assets/js/archive.js' | relative_url }} " ></script >
0 commit comments