소스 검색

Do not show tags and category in side bar if metadata field is empty

It is possible if user do not set any value in it. Ideally he should
remove the metadata field but he may miss to do it.
Talha Mansoor 11 년 전
부모
커밋
02b6a9a7ed
1개의 변경된 파일2개의 추가작업 그리고 2개의 파일을 삭제
  1. 2 2
      templates/article.html

+ 2 - 2
templates/article.html

@@ -84,11 +84,11 @@
             <time pubdate="pubdate" datetime="{{ article.date.isoformat() }}">{{ article.date.strftime('%b') }} {{ day }} {{- article.date.strftime(', %Y') }}</time>
             {% endif %}
             {% include 'last_updated.html' %}
-            {% if article.category %}
+            {% if article.category|trim|count > 0 %}
             <h4>Category</h4>
             <a class="category-link" href="{{ SITEURL }}/categories.html#{{ category.slug }}-ref">{{ article.category }}</a>
             {% endif %}
-            {% if article.tags %}
+            {% if article.tags and article.tags[0]|trim|count > 0 %}
             <h4>Tags</h4>
             <ul class="list-of-tags tags-in-article">
                 {% for tag in article.tags|sort %}