Create content stream from multiple folder sources

Hi! I’m trying to create a content feed on my portfolio’s homepage that includes chronologically-ordered listings from both my blog and my portfolio. I know how to get a stream of subpages from one folder, but mixing two folders is a bit tricky for my basic knowledge of Kirby and PHP. Can anyone help out?

I apologize if this has been solved here before, but I’m not able to pick out the right keywords to locate it if so.

Thanks!

You can merge the two collections like this:

<?php 
  $blog = page('blog')->visible()->children();
  $portfolio  = page('portfolio')->visible()->children();
  $feed = new Pages(array($blog, $portfolio));
?>

The you can filter, sort, limit the resulting feed collection as desired.

1 Like