How to adjust this "for" loop to get all sub pages

I’m displaying blog posts in a global sidebar and the snippet below works great for gathering up posts from the blog page:

-{% for post in page.find('/blog').children.order('date', 'desc').slice(0, 20) %} -

However I have three blog style pages and I’d like my sidebar to gather the blog posts from all three pages and then show the 20 most recent sorted by date regardless of what page they are children of.

/blog
/science
/diversions

How would I adjust the snippet to create a collection from all three of the blog style pages above?

Thanks in advance!

I think you’d have to query each blog page separately and build a page collection, then order the collection.

Thanks- I think I should have phrased my question better: What is the code to load the three blogs, then build the collection, then order the collection?

I’m just learning this stuff myself, so ymmv, but it’s something based on this:

{% set collection = page.evaluate([{'@page.children':'/blog', '@taxonomy.tag':'photography'}]) %}

If you did that three times with different page.children and instead of ‘set collection’ you used whatever twig command would add your results to “collection” instead of overwrite it then you could loop through collection and order it with this:

{% set ordered_collection = collection.order('date','desc') %}

and get the results you want. Not sure how to limit it to 20 but it’s probably something simple in twig.

Some helpful info here: https://learn.getgrav.org/content/collections

Should have removed the @taxonomy.tag stuff from the example. It’s irrelevant.