1
Fork 0

ensure there's less newlines

This commit is contained in:
Jan-Erik Rediger 2025-03-13 10:35:55 +01:00
parent 804953cbd1
commit 261ddc6f6a

View file

@ -8,51 +8,51 @@ data:
<a href="/tagged/">Post by tag</a>
{% assign years = "2025, 2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017, 2016, 2015, 2014, 2013, 2012, 2011" | split: ", " %}
{% assign maxcount = 0 %}
{% assign years = "2025, 2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017, 2016, 2015, 2014, 2013, 2012, 2011" | split: ", " -%}
{% assign maxcount = 0 -%}
{% for year in years -%}
{% assign count = 0 %}
{%- for post in collections.posts.pages %}
{%- assign postyear = post.published_date | date: "%Y" %}
{%- if postyear == year %}
{% assign count = count | plus: 1 %}
{% endif %}
{% endfor %}
{% if count > maxcount %}
{% assign maxcount = count %}
{% endif %}
{% endfor %}
{% assign count = 0 -%}
{%- for post in collections.posts.pages -%}
{%- assign postyear = post.published_date | date: "%Y" -%}
{%- if postyear == year -%}
{% assign count = count | plus: 1 -%}
{% endif -%}
{% endfor -%}
{% if count > maxcount -%}
{% assign maxcount = count -%}
{% endif -%}
{% endfor -%}
<p>A count of all posts by year — {{ years|size }} years running!</p>
<ol class="archive-chart">
{% for year in years -%}
{% assign count = 0 %}
{%- for post in collections.posts.pages %}
{%- assign postyear = post.published_date | date: "%Y" %}
{%- if postyear == year %}
{% assign count = count | plus: 1 %}
{% endif %}
{% endfor %}
{% assign count = 0 -%}
{%- for post in collections.posts.pages -%}
{%- assign postyear = post.published_date | date: "%Y" -%}
{%- if postyear == year -%}
{% assign count = count | plus: 1 -%}
{% endif -%}
{% endfor -%}
<li>
<a href="#{{year}}">
<span>{{year}}</span>
<span>{{count}}</span>
</a>
{% assign u = count | times: 100 %}
{% assign w = u | divided_by: maxcount %}
{% assign u = count | times: 100 -%}
{% assign w = u | divided_by: maxcount -%}
<span class="archive-chart-bar" style="width:{{w}}%"></span>
</li>
{% endfor %}
{% endfor -%}
</ol>
{% for year in years -%}
<h2 id="{{year}}">{{year}}</h2>
<ul class="posts-list">
{%- for post in collections.posts.pages %}
{%- assign postyear = post.published_date | date: "%Y" %}
{%- if postyear == year %}
{%- for post in collections.posts.pages -%}
{% assign postyear = post.published_date | date: "%Y" -%}
{% if postyear == year %}
<li>
<a href="/{{post.permalink }}">
<span>{{post.title}}</span>
@ -61,7 +61,7 @@ data:
</span>
</a>
</li>
{%- endif %}
{%- endfor %}
{% endif -%}
{% endfor -%}
</ul>
{%- endfor %}
{% endfor -%}