{% for section in nav|selectattr("is_section") %} {% set first_page = section|first_page %} {% if first_page %} {{ section.title }} {% endif %} {% endfor %}