Properly detect if a page has tags or categories

- Arrays are truthy, test on first item instead
This commit is contained in:
Michael Rose 2016-03-10 22:12:37 -05:00
parent cf0db7c19a
commit a31bd447d0

View file

@ -5,7 +5,8 @@
<!-- modified from http://www.codeofclimber.ru/2015/sorting-site-tags-in-jekyll/ -->
{% endcomment %}
{% if site.tags_archive_filename %}
{% if page.tags[0] %}
{% if site.tags_archive_filename %}
{% capture page_tags %}{% for tag in page.tags %}{{ tag | downcase }}#{{ tag }}{% unless forloop.last %},{% endunless %}{% endfor %}{% endcapture %}
{% assign tag_hashes = (page_tags | split: ',' | sort:0) %}
@ -17,9 +18,11 @@
{% endfor %}
</span>
</p>
{% endif %}
{% endif %}
{% if site.categories_archive_filename %}
{% if page.categories[0] %}
{% if site.categories_archive_filename %}
{% capture page_categories %}{% for category in page.categories %}{{ category | downcase }}#{{ category }}{% unless forloop.last %},{% endunless %}{% endfor %}{% endcapture %}
{% assign category_hashes = (page_categories | split: ',' | sort:0) %}
@ -31,4 +34,5 @@
{% endfor %}
</span>
</p>
{% endif %}
{% endif %}