Expand description
Per-request theme resolution.
Walks this chain for each public page request, returning the first
hit (or None if nothing’s configured):
page.theme_id— explicit theme on the rendered page itself.- Each ancestor’s
theme_id, climbing toward the root. - The
cms_themerow withis_default = true(site default). - The
cms_themerow withis_admin_default = true(last resort, so the public site doesn’t render naked when the operator only set the admin theme).
The walk uses the page’s materialized path to fetch every
ancestor in one indexed SELECT — no recursive query, no
per-segment round-trip.
Structs§
- Resolved
Theme - What
resolve_for_pagereturns: the matched theme + its brand colors, ready to feed intocrate::theme::emit_css.
Functions§
- resolve_
for_ page - Walk the resolution chain and return the active theme for
page.Nonemeans “no theme configured anywhere”; the caller should skip emitting the<style>block and let the public template fall back to its own defaults.