Reference

Guide

$site->children()

Returns the Pages collection

$site->children(): Pages

Return type

Pages

<nav class="main-menu" role="navigation">
  <ul>
    <?php foreach($site->children()->listed() as $item): ?>
    <li><a<?php e($item->isOpen(), ' class="active"') ?> href="<?= $item->url() ?>"><?= html($item->title()) ?></a></li>
    <?php endforeach ?>
  </ul>
</nav>

Source code

kirby/src/Cms/HasChildren.php#L29