--- layout: archive --- {{ content }} {% comment %} Flatten all documents in all categories {% endcomment %} {% assign docs = "" | split: "" %} {% for collection in site.collections %} {% assign docs = docs | concat: collection.docs %} {% endfor %} {% comment %} Extract all tags {% endcomment %} {% for doc in docs %} {% assign all_tags = all_tags | concat: doc.tags %} {% endfor %} {% assign unique_tags = all_tags | uniq %} {% assign tags_count = "" | split: "" %} {% assign tagged_docs = "" | split: "" %} {% assign tags_max = 0 %} {% for tag in unique_tags %} {% comment %} Count the number of tag occurrence in all docs {% endcomment %} {% assign count = 0 %} {% for t in all_tags %} {% if t == tag %} {% assign count = count | plus: 1 %} {% endif %} {% endfor %} {% assign tags_count = tags_count | push: count %} {% comment %} Group docs by tags {% endcomment %} {% assign found = docs | where_exp: "item", "item.tags contains tag" %} {% assign tagged_docs = tagged_docs | push: found %} {% if count > tags_max %} {% assign tags_max = count %} {% endif %} {% endfor %} {% assign entries_layout = page.entries_layout | default: 'list' %} {% for i in (1..tags_max) reversed %} {% for tag in unique_tags %} {% if tags_count[forloop.index0] == i %}

{{ tag }}

{% for post in tagged_docs[forloop.index0] %} {% include archive-single.html type=entries_layout %} {% endfor %}
{{ site.data.ui-text[site.locale].back_to_top | default: 'Back to Top' }} ↑
{% endif %} {% endfor %} {% endfor %}