Kaynağa Gözat

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 yıl önce
ebeveyn
işleme
02b6a9a7ed
1 değiştirilmiş dosya ile 2 ekleme ve 2 silme
  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 %}