Is there an easy way to include a list of newest or last updated pages in a grav page?
Thanks a lot,
Raf
Is there an easy way to include a list of newest or last updated pages in a grav page?
Thanks a lot,
Raf
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.
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:
Regards,
Raf