Skip to content

Commit

Permalink
Fixed a bug in the Categories hierarchy. (barryclark#48, barryclark#57)
Browse files Browse the repository at this point in the history
When one post have only one category will hit the bug.
  • Loading branch information
cotes2020 committed May 22, 2020
1 parent 08d4ce7 commit 532e7ad
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions tabs/categories.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,11 @@ title: Categories

{% for post in posts_of_category %}
{% assign second_category = post.categories[1] %}
{% unless sub_categories contains second_category %}
{% assign sub_categories = sub_categories | push: second_category %}
{% endunless %}
{% 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 %}
Expand Down

0 comments on commit 532e7ad

Please sign in to comment.