page()
Fetches a single page by id or the current page when no id is specified
page(string|null $id = null): Kirby\Cms\Page|null
Parameters
| Name | Type | Default |
|---|---|---|
| $id | stringornull |
null
|
Return types
Kirby\Cms\Pageornull
Examples
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').