Can someone show me an example of how the twig sort filter works? I can’t find good examples anywhere. I have this:
{% set page_newsletter = page.find('/parents/newsletter') %}
{% for p in page_newsletter.children %}
foo
{% endfor %}
I only want to get the first child page under /parents/newsletter ordered by date and sorted either asc or desc (so the oldest newsletter, or the latest).
Hi Perlkonig, sorry - I did read that doc page but it doesn’t tell me anything at all about how to use the actual function… and I still can’t see, even from your example. Do you know how I could use the sort filter to sort a loop by date? I don’t get it…
It completely depends on how your data and templates are structured. The typical way is through page collections, which is how all the blog templates work.