how can I retrieve a single page from a page collection in one line?
{% set second_page = page.children[1] %}
something like this?
how can I retrieve a single page from a page collection in one line?
{% set second_page = page.children[1] %}
something like this?
Yes you can do that, it will do that if your array is integer based. However, i don’t ‘think’ collections are. One way to get around this is to use []
notation but with the slice syntactic sugar:
{% set second_page = page.children[2:2] %}
does not work
Try dumping page.children and make sure you actually have children available:
{{ dump(page.children) }}