Verified Commit d9bdc2d9 authored by tyil's avatar tyil

Redo the blog post list logic

parent 1e658c4b
Pipeline #154755805 passed with stages
in 5 minutes and 43 seconds
......@@ -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 %}
</ul>
{% endif %}
{% if forloop.first %}
<h3>{{ this_year }}</h3>
<ul>
{% endif %}
......@@ -30,11 +33,7 @@ layout: default
{% if forloop.last %}
</ul>
{% else %}
{% if this_year != next_year %}
</ul>
<h3>{{ next_year }}</h3>
<ul>
{% endif %}
{% endif %}
{% assign prev_year = post.date | date: "%Y" %}
{% endfor %}
......@@ -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 %}
</ul>
{% endif %}
{% if forloop.first %}
<h3>{{ this_year }}</h3>
<ul>
{% endif %}
......@@ -28,18 +31,14 @@ description: >
<small>
{{ post.date | date: "%Y-%m-%d" }}
{% for tag in post.tags %}
<a href="{{ site.baseurl | prepend: site.url }}/tag/{{ tag | slugify }}">#{{ tag | slugify}}</a>
<a href="{{ site.baseurl | prepend: site.url }}/tag/{{ tag | slugify }}">#{{ tag | slugify }}</a>
{% endfor %}
</small>
</li>
{% if forloop.last %}
</ul>
{% else %}
{% if this_year != next_year %}
</ul>
<h3>{{ next_year }}</h3>
<ul>
{% endif %}
{% endif %}
{% assign prev_year = post.date | date: "%Y" %}
{% endfor %}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment