Reference

Guide

$pages->index()

Create a recursive flat index of all pages and subpages, etc.

$pages->index(bool $drafts = false): Kirby\Cms\Pages

Parameters

Name Type Default Description
$drafts bool false

Return type

Kirby\Cms\Pages

// goes through any subpage, subsubpage, etc. below $page and returns them by template
$articles = $page->children()->index()->filterBy('template', 'article');

// the index method is also perfect for searching
$results = $page->children()->index()->search('mysearchword');

Source code

kirby/src/Cms/Pages.php#L328