$page->depth()

Returns a number, which represents the nesting depth of the page

  • return (integer)

Example

<select onchange="window.location.href = this.value">
<?php foreach($site->index() as $p): ?>
<option value="<?= $p->url() ?>">
  <?= str_repeat('-', $p->depth()) ?>
  <?= html($p->title()) ?>
</option>
<?php endforeach ?>
</select>