Get page collection in a partial template

How can i get certain page childrens in a partial template?

Tried:

{% for p in page.find('/videos').children if p != page %}
    <article class="video">
        <a href="/" class="d-block mb-3">
            <img src="{{ url('theme://images/dummy.jpg') }}" alt="..." class="img-responsive w-100 rounded">
        </a>
        <a href="/" class="d-block border-bottom">
            <p class="h6">{{ p.title }}</p>
        </a>
    </article>
{% endfor %}

But it didn’t work.

Have you tried:
{% set options = { items: {'@page.children': '/my/pages'}, 'limit': 5, 'order': {'by': 'date', 'dir': 'desc'}, 'pagination': true } %} {% set my_collection = page.collection(options) %}

This is from the advanced section of the Page Collections documentation.

1 Like

No results. Not getting childrens :frowning:

UPDATE. Found my own error, i’ve included that partial in a main template this way:

{% include 'partials/right-block.html.twig' with {'page': page.find('/video')} %}

When i removed “with” part, your code worked. How does page.find() works? In what cases?