{% assign all_tags = site.posts | map: 'tags' | join: ',' | split: ',' | uniq | sort %} {% for tag in all_tags %} {% assign tagged_posts = site.posts | where_exp: 'post', 'post.tags contains tag' | sort: 'date' | reverse %} {% if tagged_posts.size > 0 %}

#{{ tag }} {{ tagged_posts | size }} post{{ tagged_posts | size | pluralize: 's' }}

{% endif %} {% endfor %}