mmk2410.org/site/controllers/blog.php
2025-01-30 19:52:03 +01:00

19 lines
404 B
PHP

<?php
use Kirby\Cms\Page;
return function (Page $page, ?string $tag, ?string $category): array {
$articles = $page->children()->listed();
if ($tag) {
$articles = $articles->filterBy('tags', $tag, ',');
}
if ($category) {
$articles = $articles->filterBy('categories', $category, ',');
}
return [
'articles' => $articles->flip()->paginate(20)
];
};