page()
Fetches a single page or multiple pages by id or the current page when no id is specified
page(string|array $id = null): Kirby\Cms\Page|Kirby\Cms\Pages|null
Parameters
Name | Type | Default |
---|---|---|
$id | string |array |
null |
Return type
Kirby\Cms\Page
|Kirby\Cms\Pages
|null
The page()
helper throws a deprecation warning if multiple IDs get passed. Starting in 3.7.0 it will only return the first page. Use pages()
for multiple pages instead.
Example
Fetching a specific page by URI
<?= page('blog')->title() ?>
Fetching the current page
<?= page()->title() ?>
The page()
helper fetches published pages only. To fetch a draft, you have to use $kirby->page('somepage')
.