pub struct PageConfig<'a> {
pub title: &'a str,
pub route_pattern: &'a str,
pub manifest: &'a AssetManifest,
pub config_script: Option<&'a str>,
pub config_json: Option<&'a Value>,
pub body_class: Option<&'a str>,
pub personality_css: Option<&'a str>,
pub body_prefix: Option<&'a str>,
pub render_mode: RenderMode,
pub ir_module: Option<&'a IrModule>,
pub slots: Option<&'a SlotData>,
}Expand description
Configuration for rendering an HTML page with external assets.
Fields§
§title: &'a strText for the page’s <title>, HTML-escaped on the way out.
route_pattern: &'a strThe route this page was matched by, used to look up its assets in the
manifest (e.g. /users/:id).
manifest: &'a AssetManifestBuild manifest naming the content-hashed JS/CSS/font/IR files.
config_script: Option<&'a str>Optional inline <script> content (e.g. window.__CONFIG__ = {...}).
RAW, TRUSTED ESCAPE HATCH. The content is emitted into an inline
<script> with no JavaScript escaping. </script and <!-- are
neutralized so the value cannot break out of the element, but that is
not the same as making it safe: a " or \ arriving from untrusted
data still yields nonce-blessed script execution inside your own page.
Use PageConfig::config_json for anything derived from user input.
config_json: Option<&'a Value>Optional server data to expose to the client as
window.__FORMA_CONFIG__.
This is the safe path: the value is serialized by serde_json with
every < escaped, which cannot be misused no matter what the data
contains. Prefer it over PageConfig::config_script.
body_class: Option<&'a str>Optional class attribute for <body>, HTML-escaped.
personality_css: Option<&'a str>Optional inline <style> for personality/theme overrides.
Emitted inside a <style> element. </ is neutralized (as a CSS
escape, losslessly) so the value cannot break out; everything else is
passed through as CSS.
body_prefix: Option<&'a str>Optional extra HTML before <div id="app">.
RAW, TRUSTED HTML. Interpolated verbatim with no escaping — that is
the point of the field (callers use it to emit their own markup, e.g. a
hand-rendered __forma_islands block). Never build it from untrusted
data.
render_mode: RenderModeWhether to server-render the body or ship an empty #app shell.
ir_module: Option<&'a IrModule>Pre-parsed IR module for Phase 2 SSR
slots: Option<&'a SlotData>Slot data for Phase 2 SSR