List of newest/latest pages


#1

Is there an easy way to include a list of newest or last updated pages in a grav page?

Thanks a lot,

 Raf

#2

Hello Raf,
Page collections can do what you’re looking for.
There’s a PHP collection example here: https://learn.getgrav.org/content/collections#php-collections

A Twig example is slightly below that link. You can then iterate through the collection and display titles with links.


#3

Thanks for the tip!

I used the code at the end of the article, but I have changed the options

{% set options = { items: {’@page.children’: ‘/’}, ‘limit’: 5, ‘order’: {‘by’: ‘date’, ‘dir’: ‘desc’}, ‘pagination’: true } %}

But, it only gives the result of my first menu item (Home), althoughI have specified the ‘/’ as root:

The menu structure is as follows:
Selection_067

Regards,

Raf