Sierra guide / Routing
The page object
page is one object that holds everything about the current route: its params, its query, its data, its frontmatter. It is a plain object, and a component makes the fields it uses reactive with a $: path watch.
<script>
import { page } from '@frontierjs/sierra/router'
$: (page.params, page.data)
</script>
<h1>{page.title}</h1>
<p>{page.params.slug}</p>
{#if page.error}<p class="error">{page.error.message}</p>{/if}
What else it can do
pathname,searchandhashare the current addressparamsis the path captures, so/leads/:leadId/gives{ leadId }queryis the URL's filters, coerced, so?status=active&tier=3gives{ status: 'active', tier: 3 }directivesis the URL's$params, so?$limit=20&$orderBy=-namegives{ limit: 20, orderBy: '-name' }orders.tethered()readspage.queryandpage.directives, so a filtered, sorted, paged list lives in its URL and survives a reloadsetParams(obj)andupdateParams(fn)write the query back to the URLmetais the raw frontmatter, and each of its keys is also spread ontopagerouteis the matched route node, andpendingis the in-flight route during a navigationdatais what the route'sload()returned, anderroris what it threwslotsholds the named slots a page providedtitlealso becomesdocument.titleon every navigation
In depth: Sierra README § The page object