Is there an easy way to include a list of newest or last updated pages in a grav page?
Thanks a lot,
Raf
Community guidelines
Please keep discussions civil and on-topic. Repeated violations may lead to a temporary ban.
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
Log in to reply.
| Topic | Participants | Replies | Views | Activity |
|---|---|---|---|---|
| 6 | 97 | 8 months ago | ||
| 10 | 185 | 1 year ago | ||
| 4 | 148 | 1 year ago | ||
| 3 | 61 | 1 year ago | ||
| 4 | 255 | 1 year ago |