--- title: Categories # All the Categories of posts # v2.0 # https://github.com/cotes2020/jekyll-theme-chirpy # © 2017-2019 Cotes Chung # MIT License --- {% assign HEAD_PREFIX = "h_" %} {% assign LIST_PREFIX = "l_" %} {% assign group_index = 0 %} {% assign sort_categories = site.categories | sort %} {% for category in sort_categories %} {% assign category_name = category | first %} {% assign posts_of_category = category | last %} {% assign first_post = posts_of_category | first %} {% if category_name == first_post.categories[0] %} {% assign sub_categories = "" | split: "" %} {% for post in posts_of_category %} {% assign second_category = post.categories[1] %} {% if second_category %} {% unless sub_categories contains second_category %} {% assign sub_categories = sub_categories | push: second_category %} {% endunless %} {% endif %} {% endfor %} {% assign sub_categories = sub_categories | sort %} {% assign sub_categories_size = sub_categories | size %}