sort tags, don't print with only 1 tag

This commit is contained in:
⧉ infominer 2020-12-04 20:22:46 -05:00
parent ea011e2093
commit b8b0b5137b

View File

@ -5,7 +5,8 @@ layout: archive
{{ content }} {{ content }}
{% assign tags_max = 0 %} {% assign tags_max = 0 %}
{% for tag in site.tags %} {% assign sortedtags = site.tags | sort %}
{% for tag in sortedtags %}
{% if tag[1].size > tags_max %} {% if tag[1].size > tags_max %}
{% assign tags_max = tag[1].size %} {% assign tags_max = tag[1].size %}
{% endif %} {% endif %}
@ -13,20 +14,22 @@ layout: archive
<ul class="taxonomy__index"> <ul class="taxonomy__index">
{% for i in (1..tags_max) reversed %} {% for i in (1..tags_max) reversed %}
{% for tag in site.tags %} {% for tag in sortedtags %}
{% if tag[1].size == i %} {% if tag[1].size == i %}
<li> {% unless tag[1].size == 1 %}
<a href="#{{ tag[0] | slugify }}"> <li>
<strong>{{ tag[0] }}</strong> <span class="taxonomy__count">{{ i }}</span> <a href="#{{ tag[0] | slugify }}">
</a> <strong>{{ tag[0] }}</strong> <span class="taxonomy__count">{{ i }}</span>
</li> </a>
</li>
{% endunless %}
{% endif %} {% endif %}
{% endfor %} {% endfor %}
{% endfor %} {% endfor %}
</ul> </ul>
{% for i in (1..tags_max) reversed %} {% for i in (1..tags_max) reversed %}
{% for tag in site.tags %} {% for tag in sortedtags %}
{% if tag[1].size == i %} {% if tag[1].size == i %}
{% unless tag[1].size == 1 %} {% unless tag[1].size == 1 %}
<section id="{{ tag[0] | slugify | downcase }}" class="taxonomy__section"> <section id="{{ tag[0] | slugify | downcase }}" class="taxonomy__section">