How to display selected articles from a blog with a different template

I have created a Kirby website mainly with a focus on the /blog and now I want to have a dedicated /page that contains only articles of that blog that have a specific #tag and display them in a different layout than the /blog template.
Therefore I have created a new blueprint and template but now I don’t know how to select the mentioned articles for this new website area.
Do I need to define a route or create a filterBy rule?

You can filter your articles like this:

$articlesWithTagX = page('blog')->children()->listed()->filterBy('tags', 'x', ',');

Thanks, it is easier than I first thought.
I simply created a new template (based on a blog copy) but no new blueprint and added a new controller with this article filter:

  $articles = page('blog')->children()->listed()->filterBy('tags', 'ux', ',')->filter(function ($child) {
    return $child->translation(kirby()->language()->code())->exists();
    })->flip();

The only limitation with this approach is that I don’t see all related articles in the panel if I open the new page there but instead I have to manually find all articles by hand within the blog page.
Is there any way to show only articles from another page (blog) with a specific tag on the new page in the panel?

Yes, with the pagesdisplay plugin where you can use a query: https://getkirby.com/plugins/rasteiner/pagesdisplay

But that would only work with a new blueprint

1 Like