# Get the number of listed pages

**URL:** <https://forum.getkirby.com/t/get-the-number-of-listed-pages/28704>\
**Category:** Questions\
**Tags:** v3\
**Created:** [May 31, 2023, 1:13pm UTC](https://forum.getkirby.com/t/get-the-number-of-listed-pages/28704 "2023-05-31T13:13:37Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![nirsh](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/nirsh/32/11552_2.png) [@nirsh](https://forum.getkirby.com/u/nirsh)\
**Post date:** [May 31, 2023, 1:13pm UTC](https://forum.getkirby.com/t/get-the-number-of-listed-pages/28704/1 "2023-05-31T13:13:37Z")

</div>

Hi!  
I have a list of listed pages and I want to get the number of each page to present next to its title.  
for some reason Im having a hard time doing it.

this is my poor try:  
page controller

```auto
<?php

return function ( $page, $site, $kirby ) {

    $random = page('articles')->children()->listed()->shuffle()->first();
    $articles = page('articles')->children()->listed();

    return [
        'articles' => $articles,
        'random' => $random,
    ];
};

```

page template:

```auto

<ul class='articles-list'>
        <li>
            <a href="<?= $random->url() ?>">
                <h2><?= $random->title() ?></h2>
            </a>
        </li>
        <?php foreach ($articles->not($random) as $article): ?>
            <li>
               <a href="<?= $article->url() ?>">
                   <p><?= $article->pagination()->currentPage()?></p>
                   <h2><?= $article->title() ?></h2>
               </a>
            </li>
        <?php endforeach ?>
</ul>

```

any idea how to make it work?

I will appreciate any help! 🙏

---

<div class="post-metadata">

**Author:** ![nirsh](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/nirsh/32/11552_2.png) [@nirsh](https://forum.getkirby.com/u/nirsh)\
**Post date:** [May 31, 2023, 2:31pm UTC](https://forum.getkirby.com/t/get-the-number-of-listed-pages/28704/2 "2023-05-31T14:31:30Z")

</div>

I realized now that all I need is to use the num() method.  
Sorry 🙏
