pub struct PageConfig {Show 15 fields
pub source_path: String,
pub title: Option<String>,
pub canonical_url: Option<String>,
pub description: Option<String>,
pub lang: Option<String>,
pub og_image: Option<String>,
pub twitter_card: Option<String>,
pub icons: Vec<HeadIcon>,
pub stylesheets: Vec<String>,
pub scripts: Vec<HeadScript>,
pub theme_init: bool,
pub theme_key: Option<String>,
pub embed_css: bool,
pub head_extra: Option<String>,
pub reading_frame: Option<ReadingFrame>,
}Expand description
Configuration for full-page HTML rendering with SurfDoc discovery metadata.
Fields§
§source_path: StringPath to the original .surf source file (served alongside the built site).
Used in <link rel="alternate"> and the HTML comment.
title: Option<String>Page title. Falls back to front matter title, then “SurfDoc”.
canonical_url: Option<String>Optional canonical URL for <link rel="canonical">.
description: Option<String>Optional meta description. Falls back to front matter description.
lang: Option<String>Optional language code (default: “en”).
og_image: Option<String>Optional OG image URL for social sharing.
twitter_card: Option<String>Twitter card type: summary (default) or summary_large_image.
icons: Vec<HeadIcon>Favicon / apple-touch-icon links, emitted in order.
stylesheets: Vec<String>External stylesheet hrefs, emitted in order (after the inlined base CSS
when embed_css is true). Cache-bust by including ?v=N in the href.
scripts: Vec<HeadScript>External scripts, emitted in <head> in order.
theme_init: boolEmit the inline pre-paint theme resolver + toggleTheme/toggleDrawer/
closeDrawer helpers in <head> (FOUC-safe; must run before paint).
theme_key: Option<String>localStorage key for the persisted theme. Defaults to theme.
embed_css: boolInline the full SurfDoc CSS as a <style> block (default true). Set
false when the consumer links the stylesheet itself (via stylesheets).
head_extra: Option<String>Arbitrary extra markup injected at the end of <head>.
reading_frame: Option<ReadingFrame>When set, to_shell_page wraps the page content in a reading-frame
(sticky toolbar + centered sheet). None leaves pages unchanged.
Implementations§
Source§impl PageConfig
impl PageConfig
Sourcepub fn from_site_doc(doc: &SurfDoc) -> Self
pub fn from_site_doc(doc: &SurfDoc) -> Self
Build a PageConfig whose head config is read from the document’s
::site block, so the page is self-describing. Recognised ::site
properties:
description,og-image,twitter-card,lang,theme-keycanonical/url(canonical URL)favicon(rel=icon, sizes=any),icon-16/icon-32(png),apple-touch-iconstylesheet(repeatable),script/script-defer(repeatable)theme-init: true,embed-css: false
Per-page fields (title, description, canonical_url) can still be
overridden by the caller after construction.
Trait Implementations§
Source§impl Clone for PageConfig
impl Clone for PageConfig
Source§fn clone(&self) -> PageConfig
fn clone(&self) -> PageConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more