Skip to content

Kirby 4.3.0


Creates a flat child index

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


Name Type Default Description
$drafts bool false If set to true, draft children are included

Return type


Parent class


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

// the index method is also perfect for a site-wide search
$results = $site->index()->search('mysearchword');


$site->index() reads the entire folder structure including all files. Especially on large sites with many files, using $site->index() can result in big performance issues, so use with caution.