Page.find() - how to exclude modular pages?


Grav version : 1.1rc3

I want to publish the latest content (whatever the content type) but so far it includes also some modular pages. Is there a way to exclude modular pages from the page list ?

 {% for page in page.find('/').children.order('date', 'desc').slice(0, 5) %}
            <div class="media-object">
                {% set showcase_image =|first.resize(100,100).url %}
                {% if showcase_image %}
                <div class="media-object-section">
                    <img alt="{{ page.title }}" src="{{ showcase_image }}" />
                {% endif %}
                <div class="media-object-section">
                    <h5><a href="{{ page.url }}">{{ page.title }}</a></h5>
            {% endfor %}

I tried to use dump(page) to get more data but I can’t see on what I could filter to exclude modular content.


The .children method returns a Collection of pages. You can then use the .nonModular method to filter out modular pages:

{% for page in page.find('/').children.nonModular.order('date', 'desc').slice(0, 5) %}

Thanks a lot, I missed this point !