Inline ordering

I want to order the output of:

{% set posts = page.find('/blog/posts').children %}

how can I order the children by header.date (a separate field in my page-frontmatter) descending ?

thank you.

Try this:

{% set posts = page.find('/blog/posts').children.order('date', 'desc') %}
---

thanks. but it seems that the first parameter is skipped during rendering process, only the default order is being kept. at least ‘desc’ seems to work.

my frontmatter now looks like this:

timestamp: '2017-02-21T18:20'

how can I choose to take the timestamp-field instead of ‘date’ ?!

simply swapping doesn’t help

Try swapping ‘date’ with ‘timestamp’.

{% set posts = page.find('/blog/posts').children.order('timestamp', 'desc') %}
---

changing the variable-name in the front-matter finally has helped.

I chose: publish_date … and it works.

nevertheless, thanks for your advice, @robbinfellow !!

No problem @timomue! Glad you got it working in the end.

A little tip is to use the dump(page) function to see what data is available, you can read more about it here: https://learn.getgrav.org/themes/twig-filters-functions#dump