$pages->count displaying wrong number

I am creating a website that will be content heavy with articles.
At the bottom I want there to be the current article number and then also the total number of articles.

Current page number is easy in my article.php with
<?php echo $page->num() ?>

However getting the total number of articles has been difficult. I’ve currently populated my website with 12 articles as so.

but using
$pages->count()

in the article.php shows the number 7 instead and I’m confused as to why.
I’ve looked at the $pages->count Kirby webpage but none of the options it provides are applicable.

$pages is a special variable that refers to the children of site, i.e. the folders directly in the content folder. To get the correct number of articles, count the children of the parent, suppose your parent is blog:

$count = page('blog')->children()->count();
1 Like