Properly detect if a page has tags or categories
- Arrays are truthy, test on first item instead
This commit is contained in:
parent
cf0db7c19a
commit
a31bd447d0
1 changed files with 26 additions and 22 deletions
|
@ -5,6 +5,7 @@
|
|||
<!-- modified from http://www.codeofclimber.ru/2015/sorting-site-tags-in-jekyll/ -->
|
||||
{% endcomment %}
|
||||
|
||||
{% 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) %}
|
||||
|
@ -18,7 +19,9 @@
|
|||
</span>
|
||||
</p>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
{% 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) %}
|
||||
|
@ -32,3 +35,4 @@
|
|||
</span>
|
||||
</p>
|
||||
{% endif %}
|
||||
{% endif %}
|
Loading…
Reference in a new issue