Procházet zdrojové kódy

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 před 11 roky
rodič
revize
02b6a9a7ed
1 změnil soubory, kde provedl 2 přidání a 2 odebrání
  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 %}