Fixed a bug in the Categories hierarchy. (#48, #57)

When one post have only one category will hit the bug.
This commit is contained in:
Cotes Chung 2020-05-22 18:02:28 +08:00
parent 08d4ce77e2
commit 532e7ad451

View file

@ -20,9 +20,11 @@ title: Categories
{% 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 %}