ensure there's less newlines
This commit is contained in:
parent
804953cbd1
commit
261ddc6f6a
1 changed files with 29 additions and 29 deletions
58
posts.liquid
58
posts.liquid
|
@ -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 -%}
|
||||
|
|
Loading…
Add table
Reference in a new issue