--- 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 %}