From d9bdc2d9d5136b3473525c4db015c133667bb05d Mon Sep 17 00:00:00 2001
From: Patrick Spek
Date: Wed, 10 Jun 2020 11:53:04 +0200
Subject: Redo the blog post list logic
---
_layouts/archive.html | 17 ++++++++---------
_pages/posts.html | 19 +++++++++----------
2 files changed, 17 insertions(+), 19 deletions(-)
diff --git a/_layouts/archive.html b/_layouts/archive.html
index 4c30f96..c794c22 100644
--- a/_layouts/archive.html
+++ b/_layouts/archive.html
@@ -10,10 +10,13 @@ layout: default
{% for post in page.posts %}
{% if post.wip %}{% continue %}{% endif %}
- {% capture this_year %}{{ post.date | date: "%Y" }}{% endcapture %}
- {% capture next_year %}{{ post.previous.date | date: "%Y" }}{% endcapture %}
+ {% assign this_year = post.date | date: "%Y" %}
+
+ {% if this_year != prev_year %}
+ {% if forloop.first != true %}
+
+ {% endif %}
- {% if forloop.first %}
{{ this_year }}
{% endif %}
@@ -30,11 +33,7 @@ layout: default
{% if forloop.last %}
- {% else %}
- {% if this_year != next_year %}
-
- {{ next_year }}
-
- {% endif %}
{% endif %}
+
+ {% assign prev_year = post.date | date: "%Y" %}
{% endfor %}
diff --git a/_pages/posts.html b/_pages/posts.html
index 98b61b5..4f10758 100644
--- a/_pages/posts.html
+++ b/_pages/posts.html
@@ -15,10 +15,13 @@ description: >
{% for post in site.posts %}
{% if post.wip %}{% continue %}{% endif %}
- {% capture this_year %}{{ post.date | date: "%Y" }}{% endcapture %}
- {% capture next_year %}{{ post.previous.date | date: "%Y" }}{% endcapture %}
+ {% assign this_year = post.date | date: "%Y" %}
+
+ {% if this_year != prev_year %}
+ {% if forloop.first != true %}
+
+ {% endif %}
- {% if forloop.first %}
{{ this_year }}
- {% else %}
- {% if this_year != next_year %}
-
- {{ next_year }}
-
- {% endif %}
{% endif %}
+
+ {% assign prev_year = post.date | date: "%Y" %}
{% endfor %}
--
cgit v1.1