dont display zero length popular and latest

This commit is contained in:
Daniel Hladek 2020-10-03 11:13:23 +02:00
parent 7b4a270078
commit febce03328

View File

@ -82,14 +82,15 @@
{% endif %}
{% endfor %}
{% set popular = tmplst %}
{% if popular|length > 0 %}
<h1><span>{{ 'POPULAR_ARTICLES'|t }}</span></h1>
{% include 'partials/topiclist.html.twig' with {'articles': popular, 'maxcount': maxcount} %}
{% endif %}
</div>
{% endif %}
{% if grav.theme.config.params.sidebar.show.latest %}
<div class="topiclist">
<h1><span>{{ 'LATEST_ARTICLES'|t }}</span></h1>
{% 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 %}
<h1><span>{{ 'LATEST_ARTICLES'|t }}</span></h1>
{% include 'partials/topiclist.html.twig' with {'articles': articles, 'maxcount': maxcount} %}
{% endif %}
</div>
{% endif %}