Skip to content

$page / usePage()

Provides reactive access to the current OctoberCMS page.

Use $page inside Vue templates or usePage() inside Composition API code.

Basic Usage

A generic type can describe properties assigned to the page by OctoberCMS or its components.

vue
<template>
    <h1>{{ $page.title }}</h1>
</template>

<script lang="ts" setup>
import { usePage } from '@ratmd/laika';

interface PageProps {
    heading?: string;
}

const page = usePage<PageProps>();
console.log(page.value?.props.heading);
</script>

Page Properties

The ref returned by usePage() updates when navigation swaps or patches the page payload.

PropertyDescription
idOctoberCMS page identifier.
urlCurrent request URL.
fileSource page filename.
componentVue component name resolved for the page.
propsProperties assigned to the page.
layoutActive layout identifier.
themeActive theme identifier.
localeCurrent page locale.
titlePage title.
headServer-provided document-head elements.
flashCurrent info, error, success and warning flash messages.
contentServer-rendered page content.
placeholdersValues assigned to OctoberCMS placeholders.

This software is not an official OctoberCMS product and is not associated with, sponsored by, or endorsed by OctoberCMS.