I'm trying to get the 3 most recent blog posts by creation date with the following
page.find('/blog').children.order('date', 'desc').slice(0, 3)
but if I modify an old post it gets in first place.
Any idea how I can achieve that?
I'm trying to get the 3 most recent blog posts by creation date with the following
page.find('/blog').children.order('date', 'desc').slice(0, 3)
but if I modify an old post it gets in first place.
Any idea how I can achieve that?
Alright, got it to work with this
{% set posts = page.find('/blog').children.slice(1).slice(-3).reverse() %}
Get the last 3 new posts and reverse them so I can show them from newest to oldest.
Log in to reply.
| Topic | Participants | Replies | Views | Activity |
|---|---|---|---|---|
| 0 | 1326 | 9 years ago | ||
| 2 | 921 | 9 years ago | ||
| 2 | 4050 | 9 years ago | ||
| 1 | 2928 | 9 years ago | ||
| 3 | 1107 | 9 years ago |