Skip to content

Kirby 4.5.0

$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
$drafts bool false

Return type

Kirby\Cms\Pages

Parent class

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');