$pages->find($page)

Finds a $page object in the collection by UID or relative URI

  • $page (string)
    The id of a page, or a comma separated list of ids
  • return ($pages | $page)

Example

Fetch a single subpage

<?= $page->children()->find('subpage-a')->title() ?>

Fetch multiple subpages

<ul>
  <?php foreach($page->children()->find('subpage-a', 'subpage-c', 'subpage-i') as $subpage): ?>
  <li>
    <a href="<?= $subpage->url() ?>">
      <?= html($subpage->title()) ?>
    </a>
  </li>
  <?php endforeach ?>
</ul>

Is something missing or incorrect? Edit this page on Github…