Make an archive of articles and pull spesific ones in from other pages

Hi!

I was wondering if it would be possible to make an “archive” folder with many subpages (articles), and somehow be able to select which ones of the archived articles I wanted as subpages in another (top) page?

In that way I would not need to duplicate a article to “live” in mulitple places.

If I have many articles about different topics (cars, food, sports, etc.)

I have one page where I could display all the articles.

But if I wanted another “archive” pages, that only would list out the articles I wanted (maybe sports, and food articles) and I could pick and choose from the main archive, and sort the pages in the new “archive” page.

Is this possible with Kirby?

By adding tags to every page in the archive section of your website you can filter these pages by tags.

$related = page('archive')->filterBy('tags', $page->topic(), ',');

This returns a collection of pages in the archive section that are tagged with the keyword specified in the topic field of the current page. You can then simply loop over the collection as usual and display it under the page’s content (or do whatever you want).

Great suggestion!

Thank you!

Hint:
Look at blogprint - a blueprint for blogs with kirby, which YOU find at Plugins & Extensions for Kirby 2!

I have manage to do a “related” collection, but how could I combine both related and children in the same list/array?

$page-children = $page->children()->visible();
$related = page('archive')->children()->visible()->filterBy('tags', $page->topic(), ',');

I tried this:

$items = array_combine($children, $related);

But I get this error:

Warning: array_combine() expects parameter 1 to be array, object given in /site/templates/page.php on line 25

Anyone know if it is possible to combine the two? Both arrays could potentially be empty.