Loop through recents posts in all categories

I’ve set up my site that the url format is like /categorie/posttitle (post.md looks like taxonomy: category: cat1).

For an index page I’d like to loop through the latest posts in ALL categories.

While I’m able to loop throught recent posts for a specific category

<ul>
{% for post in page.find('/cat1').children.order('date', 'desc').slice(0, 10) %}
  <li>{{ post.title }}</li>
{% endfor %}
</ul>

(which works perfectly and returns the most recent posts for category 1) I’m stuck on doing it sidewide for most recent posts in all categories (/cat1, /cat2, /cat3).

I’ve tried page.find('/') or pages.children but no success.

Has anyone an idea?

rather than find a page by path, how about using a taxonomy? Ie, you can give every page a category taxonomy of post, and then use:

{% for post in taxonomy.findTaxonomy({'category':'post'}).children.order('date', 'desc').slice(0, 10) %}

Andy, thanks for your help - it’s working now :slight_smile:

{% for post in taxonomy.findTaxonomy({'category':'post'}).order('date', 'desc').slice(0, 10) %}

It might be helpful if you could add some method documentation for the taxonomy object to the theme variable docs at http://learn.getgrav.org/themes/theme-vars#taxonomy-object (or add a link to http://learn.getgrav.org/content/taxonomy )