2019-03-25 22:26:34 +01:00

19 lines
415 B
PHP
Executable File

<?php
$posts = $page->children()->filter('published');
if ($params->has('tagName')) {
$posts = $posts->filter('tags', $params->get('tagName'));
}
$posts = $posts->reverse()->paginate($page->get('posts-per-page', 5));
if ($posts->isEmpty()) {
$site->errorPage(true);
}
return array(
'posts' => $posts,
'pagination' => $posts->pagination()
);