Skip to main content

Module theme_resolve

Module theme_resolve 

Source
Expand description

Per-request theme resolution.

Walks this chain for each public page request, returning the first hit (or None if nothing’s configured):

  1. page.theme_id — explicit theme on the rendered page itself.
  2. Each ancestor’s theme_id, climbing toward the root.
  3. The cms_theme row with is_default = true (site default).
  4. The cms_theme row with is_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§

ResolvedTheme
What resolve_for_page returns: the matched theme + its brand colors, ready to feed into crate::theme::emit_css.

Functions§

resolve_for_page
Walk the resolution chain and return the active theme for page. None means “no theme configured anywhere”; the caller should skip emitting the <style> block and let the public template fall back to its own defaults.