{% if maxcount is not defined %} {% set maxcount = (articles|length) + 1 %} {% endif %} <ul> {% for p in articles|slice(0,maxcount) %} {# If the page isn't published, don't show it... #} {% if not p.header.published is defined or p.header.published %} {% if p.header.media == 'video' %} <li class="video"> {% else %} <li class="text"> {% endif %} <a href="{{p.url}}">{{ p.title|e }}</a> </li> {% endif %} {% endfor %} </ul>