$pages->limit($limit)

Returns the collection with a limited amount of pages

  • $limit (int)
    The number of items to be returned
  • return ($pages)

Example

<h2>Latest subpages</h2>
<ul>
  <?php foreach($page->children()->limit(3) as $subpage): ?>
  <li>
    <a href="<?= $subpage->url() ?>">
      <?= html($subpage->title()) ?>
    </a>
  </li>
  <?php endforeach ?>
</ul>