sortingkirby

How to sort pages in reverse chronological order?


I want to display pages in reverse chronological order based on page's name. Is there an easier way to do this than changing the page names?

Here is the Kirby's example. /content/blog/20121212-my-first-article /content/blog/20132206-a-second-article /content/blog/20142806-the-latest-article

I want the latest post – 20142806-the-latest-article – to be displayed first.


Solution

  • There is a kirby method named flip: <?php $articles = $page->children()->flip() ?>

    https://getkirby.com/docs/cheatsheet/pages/flip