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
@ -5,7 +5,8 @@
|
|||||||
<!-- modified from http://www.codeofclimber.ru/2015/sorting-site-tags-in-jekyll/ -->
|
<!-- modified from http://www.codeofclimber.ru/2015/sorting-site-tags-in-jekyll/ -->
|
||||||
{% endcomment %}
|
{% 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 %}
|
{% 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) %}
|
{% assign tag_hashes = (page_tags | split: ',' | sort:0) %}
|
||||||
|
|
||||||
@ -17,9 +18,11 @@
|
|||||||
{% endfor %}
|
{% endfor %}
|
||||||
</span>
|
</span>
|
||||||
</p>
|
</p>
|
||||||
|
{% endif %}
|
||||||
{% 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 %}
|
{% 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) %}
|
{% assign category_hashes = (page_categories | split: ',' | sort:0) %}
|
||||||
|
|
||||||
@ -31,4 +34,5 @@
|
|||||||
{% endfor %}
|
{% endfor %}
|
||||||
</span>
|
</span>
|
||||||
</p>
|
</p>
|
||||||
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
Loading…
Reference in New Issue
Block a user