Skip to content

Commit 532e7ad

Browse files
committed
Fixed a bug in the Categories hierarchy. (#48, #57)
When one post have only one category will hit the bug.
1 parent 08d4ce7 commit 532e7ad

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

tabs/categories.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,11 @@ title: Categories
2020

2121
{% for post in posts_of_category %}
2222
{% assign second_category = post.categories[1] %}
23-
{% unless sub_categories contains second_category %}
24-
{% assign sub_categories = sub_categories | push: second_category %}
25-
{% endunless %}
23+
{% if second_category %}
24+
{% unless sub_categories contains second_category %}
25+
{% assign sub_categories = sub_categories | push: second_category %}
26+
{% endunless %}
27+
{% endif %}
2628
{% endfor %}
2729

2830
{% assign sub_categories = sub_categories | sort %}

0 commit comments

Comments
 (0)