diff --git a/themes/mytheme/templates/partials/sidebar.html.twig b/themes/mytheme/templates/partials/sidebar.html.twig index 15466c62bc..7ca0aedf45 100644 --- a/themes/mytheme/templates/partials/sidebar.html.twig +++ b/themes/mytheme/templates/partials/sidebar.html.twig @@ -82,14 +82,15 @@ {% endif %} {% endfor %} {% set popular = tmplst %} + {% if popular|length > 0 %}

{{ 'POPULAR_ARTICLES'|t }}

{% include 'partials/topiclist.html.twig' with {'articles': popular, 'maxcount': maxcount} %} + {% endif %} {% endif %} {% if grav.theme.config.params.sidebar.show.latest %}
-

{{ 'LATEST_ARTICLES'|t }}

{% set tmplst = [] %} {% for page in my_collection %} {% set blisted = false %} @@ -104,6 +105,9 @@ {% endif %} {% endfor %} {% set articles = tmplst|slice(0,maxcount) %} - {% include 'partials/topiclist.html.twig' with {'articles': articles, 'maxcount': maxcount} %} + {% if articles|length > 0 %} +

{{ 'LATEST_ARTICLES'|t }}

+ {% include 'partials/topiclist.html.twig' with {'articles': articles, 'maxcount': maxcount} %} + {% endif %}
{% endif %}