$site->grandChildren()

Returns a $pages collection with all grandChildren in the /content directory

  • return ($pages)

Example structure

  • content
    • home
    • about
      • company
      • team
      • philosophy
    • projects
      • project-a
      • project-b
      • project-c

Example code

<ul>
  <?php foreach($site->grandChildren() as $item): ?>
  <li>
    <a href="<?= $item->url() ?>">
      <?= $item->title()->html() ?>
    </a>
  </li>
  <?php endforeach ?>
</ul>

Result

The code above will give you a list like this:

  • Company
  • Team
  • Philosophy
  • Project A
  • Project B
  • Project C

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