$page->isActive()

Checks if the page is the currently active page

  • return (boolean)

Example

<nav role="navigation">
  <ul>
    <?php foreach($pages as $subpage): ?>
    <li<?php e($subpage->isActive(), ' class="active"') ?>>
      <a href="<?= $subpage->url() ?>">
        <?= html($subpage->title()) ?>
      </a>
    </li>
    <?php endforeach ?>
  </ul>
</nav>