Skip to main content

PageContext

Struct PageContext 

Source
pub struct PageContext<'a> {
Show 23 fields pub title: &'a str, pub description: &'a str, pub slug: &'a str, pub body_html: &'a str, pub tree: &'a [TreeNode], pub backlinks: &'a [Backlink], pub headings: &'a [Heading], pub commit: &'a str, pub built: &'a str, pub has_history: bool, pub has_mermaid: bool, pub has_math: bool, pub base: &'a str, pub site_title: &'a str, pub search_enabled: bool, pub has_diff: bool, pub has_components_css: bool, pub has_component_island: bool, pub is_home: bool, pub graph_json: &'a str, pub graph_node_count: usize, pub graph_edge_count: usize, pub home: Option<HomeData<'a>>,
}
Expand description

Everything a single page render needs.

Fields§

§title: &'a str§description: &'a str

Optional frontmatter description:, rendered as the page header “lede” under the title on doc pages. "" → no lede paragraph.

§slug: &'a str§body_html: &'a str§tree: &'a [TreeNode]§backlinks: &'a [Backlink]

Inbound references, rendered as cards in the right rail’s “Referenced by” section (this supersedes the old in-content backlinks block).

§headings: &'a [Heading]

The h2/h3 outline of this page, for the right-rail “On this page” TOC.

§commit: &'a str

Short commit hash for the rail’s “Additional info” → Commit row. "" → the Commit row is omitted (no git repo / detached build).

§built: &'a str

Build timestamp (YYYY-MM-DD HH:MM) for the “Built” row. "" → omitted.

§has_history: bool

Whether this doc has an emitted /<slug>/history/ page (drives the nav link).

§has_mermaid: bool

Whether this page contains a mermaid diagram (gates the mermaid island script).

§has_math: bool

Whether this page contains math (gates the KaTeX stylesheet <head> link).

§base: &'a str

Deployed base path (e.g. /docs); "" → no <base> tag (default).

§site_title: &'a str

Site title; "" → no "page — site" suffix (default).

§search_enabled: bool

Whether the search UI ships (gates the trigger + search.js).

§has_diff: bool

Whether the /diff/ workspace page exists (drives the topbar diff icon).

§has_components_css: bool

Whether any component shipped a style.css (links /components.css). The component stylesheet is small + cacheable, so it links on every page when present rather than per-page.

§has_component_island: bool

Whether this page used ≥1 component with an island.js (links /components.js, gated per-page like the mermaid island).

§is_home: bool

Whether this page is the site home. Drives the home-only graph embed (the original surfaces the doc graph on the home page, not the sidebar).

§graph_json: &'a str

Force-layout graph JSON for the home embed (raw — render_page applies the </<\/ escaping for the inline <script>). "" → no graph block (not home, or the graph feature is off).

§graph_node_count: usize

Node/edge counts for the home graph caption (ignored when graph_json is empty).

§graph_edge_count: usize§home: Option<HomeData<'a>>

Home dashboard payload (hero/stats/sections/recent). Some only for the index doc; None everywhere else.

Trait Implementations§

Source§

impl<'a> Serialize for PageContext<'a>

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

§

impl<'a> Freeze for PageContext<'a>

§

impl<'a> RefUnwindSafe for PageContext<'a>

§

impl<'a> Send for PageContext<'a>

§

impl<'a> Sync for PageContext<'a>

§

impl<'a> Unpin for PageContext<'a>

§

impl<'a> UnsafeUnpin for PageContext<'a>

§

impl<'a> UnwindSafe for PageContext<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.