pub struct PageTemplateData { /* private fields */ }Expand description
Per-render template data.
Non-generic on purpose: the data a page displays is passed alongside this to the render call rather than stored on it, so every builder method below is type-preserving.
Implementations§
Source§impl PageTemplateData
impl PageTemplateData
Sourcepub fn new(
template: impl Into<String>,
page_name: impl Into<String>,
page_url: impl Into<String>,
) -> Self
pub fn new( template: impl Into<String>, page_name: impl Into<String>, page_url: impl Into<String>, ) -> Self
Names a page.
templateis the registered Handlebars name, e.g.home.page_nameis the human name, e.g.Blog. It becomes the<title>via the computeddisplay_name, which is the only way to influence the title.page_urlis this page’s path from the site root, with a leading slash, e.g./blog. It becomes the canonical URL.
Sourcepub fn with_description(self, description: impl Into<String>) -> Self
pub fn with_description(self, description: impl Into<String>) -> Self
Overrides the base description for this page.
Overrides the base social card image for this page.
Overrides the base social card alt text for this page.
Sourcepub fn with_robots(self, robots: impl Into<String>) -> Self
pub fn with_robots(self, robots: impl Into<String>) -> Self
Overrides robots::DEFAULT for this page. See robots for the
common directives.
Sourcepub fn with_jsonld(self, jsonld: Value) -> Self
pub fn with_jsonld(self, jsonld: Value) -> Self
Attaches a schema.org JSON-LD document.
Takes a Value rather than a pre-escaped string so the escaping cannot
be skipped — a </script> inside a string value would otherwise break
out of the block. @context is filled in when absent.
Sourcepub fn with_article(self, article: Article) -> Self
pub fn with_article(self, article: Article) -> Self
Marks this page as an article and attaches its metadata.
This is the only way to set og:type to article, so the type and the
article:* tags can never disagree.
Sourcepub fn replace_style_sheets<I, S>(self, style_sheets: I) -> Self
pub fn replace_style_sheets<I, S>(self, style_sheets: I) -> Self
Replaces the base stylesheet list wholesale for this page.
Sourcepub fn extend_style_sheets<I, S>(self, style_sheets: I) -> Self
pub fn extend_style_sheets<I, S>(self, style_sheets: I) -> Self
Appends to whatever stylesheet list this page ends up with.
Sourcepub fn replace_scripts<I, S>(self, scripts: I) -> Self
pub fn replace_scripts<I, S>(self, scripts: I) -> Self
Replaces the base script list wholesale for this page.
Sourcepub fn extend_scripts<I, S>(self, scripts: I) -> Self
pub fn extend_scripts<I, S>(self, scripts: I) -> Self
Appends to whatever script list this page ends up with.
Sourcepub fn description(&self) -> Option<&str>
pub fn description(&self) -> Option<&str>
This page’s description override, if any.
This page’s social image override, if any.
This page’s social image alt override, if any.
Sourcepub fn robots(&self) -> &str
pub fn robots(&self) -> &str
This page’s robots directive, defaulting to robots::DEFAULT.
Sourcepub const fn og_type(&self) -> &'static str
pub const fn og_type(&self) -> &'static str
The Open Graph object type, derived from whether this page is an article.
Sourcepub fn declared_assets(&self) -> Vec<String>
pub fn declared_assets(&self) -> Vec<String>
Every asset path this page declares for itself.
Boot-time validation walks these so a typo in a page-specific stylesheet fails the deploy rather than silently 404ing for a visitor.
Sourcepub fn resolve_style_sheets<'a>(&'a self, base: &'a [String]) -> Vec<&'a str>
pub fn resolve_style_sheets<'a>(&'a self, base: &'a [String]) -> Vec<&'a str>
Resolves the final stylesheet list: base, optionally replaced, then extended.
Sourcepub fn resolve_scripts<'a>(&'a self, base: &'a [String]) -> Vec<&'a str>
pub fn resolve_scripts<'a>(&'a self, base: &'a [String]) -> Vec<&'a str>
Resolves the final script list: base, optionally replaced, then extended.
Trait Implementations§
Source§impl Clone for PageTemplateData
impl Clone for PageTemplateData
Source§impl Debug for PageTemplateData
impl Debug for PageTemplateData
impl Eq for PageTemplateData
Source§impl PartialEq for PageTemplateData
impl PartialEq for PageTemplateData
impl StructuralPartialEq for PageTemplateData
Auto Trait Implementations§
impl Freeze for PageTemplateData
impl RefUnwindSafe for PageTemplateData
impl Send for PageTemplateData
impl Sync for PageTemplateData
impl Unpin for PageTemplateData
impl UnsafeUnpin for PageTemplateData
impl UnwindSafe for PageTemplateData
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<T> ServiceExt for T
impl<T> ServiceExt for T
Source§fn propagate_header(self, header: HeaderName) -> PropagateHeader<Self>where
Self: Sized,
fn propagate_header(self, header: HeaderName) -> PropagateHeader<Self>where
Self: Sized,
Source§fn add_extension<T>(self, value: T) -> AddExtension<Self, T>where
Self: Sized,
fn add_extension<T>(self, value: T) -> AddExtension<Self, T>where
Self: Sized,
Source§fn map_request_body<F>(self, f: F) -> MapRequestBody<Self, F>where
Self: Sized,
fn map_request_body<F>(self, f: F) -> MapRequestBody<Self, F>where
Self: Sized,
Source§fn map_response_body<F>(self, f: F) -> MapResponseBody<Self, F>where
Self: Sized,
fn map_response_body<F>(self, f: F) -> MapResponseBody<Self, F>where
Self: Sized,
Source§fn compression(self) -> Compression<Self>where
Self: Sized,
fn compression(self) -> Compression<Self>where
Self: Sized,
Source§fn decompression(self) -> Decompression<Self>where
Self: Sized,
fn decompression(self) -> Decompression<Self>where
Self: Sized,
Source§fn trace_for_http(self) -> Trace<Self, SharedClassifier<ServerErrorsAsFailures>>where
Self: Sized,
fn trace_for_http(self) -> Trace<Self, SharedClassifier<ServerErrorsAsFailures>>where
Self: Sized,
Source§fn trace_for_grpc(self) -> Trace<Self, SharedClassifier<GrpcErrorsAsFailures>>where
Self: Sized,
fn trace_for_grpc(self) -> Trace<Self, SharedClassifier<GrpcErrorsAsFailures>>where
Self: Sized,
Source§fn follow_redirects(self) -> FollowRedirect<Self>where
Self: Sized,
fn follow_redirects(self) -> FollowRedirect<Self>where
Self: Sized,
Source§fn sensitive_headers(
self,
headers: impl IntoIterator<Item = HeaderName>,
) -> SetSensitiveRequestHeaders<SetSensitiveResponseHeaders<Self>>where
Self: Sized,
fn sensitive_headers(
self,
headers: impl IntoIterator<Item = HeaderName>,
) -> SetSensitiveRequestHeaders<SetSensitiveResponseHeaders<Self>>where
Self: Sized,
Source§fn sensitive_request_headers(
self,
headers: impl IntoIterator<Item = HeaderName>,
) -> SetSensitiveRequestHeaders<Self>where
Self: Sized,
fn sensitive_request_headers(
self,
headers: impl IntoIterator<Item = HeaderName>,
) -> SetSensitiveRequestHeaders<Self>where
Self: Sized,
Source§fn sensitive_response_headers(
self,
headers: impl IntoIterator<Item = HeaderName>,
) -> SetSensitiveResponseHeaders<Self>where
Self: Sized,
fn sensitive_response_headers(
self,
headers: impl IntoIterator<Item = HeaderName>,
) -> SetSensitiveResponseHeaders<Self>where
Self: Sized,
Source§fn override_request_header<M>(
self,
header_name: HeaderName,
make: M,
) -> SetRequestHeader<Self, M>where
Self: Sized,
fn override_request_header<M>(
self,
header_name: HeaderName,
make: M,
) -> SetRequestHeader<Self, M>where
Self: Sized,
Source§fn append_request_header<M>(
self,
header_name: HeaderName,
make: M,
) -> SetRequestHeader<Self, M>where
Self: Sized,
fn append_request_header<M>(
self,
header_name: HeaderName,
make: M,
) -> SetRequestHeader<Self, M>where
Self: Sized,
Source§fn insert_request_header_if_not_present<M>(
self,
header_name: HeaderName,
make: M,
) -> SetRequestHeader<Self, M>where
Self: Sized,
fn insert_request_header_if_not_present<M>(
self,
header_name: HeaderName,
make: M,
) -> SetRequestHeader<Self, M>where
Self: Sized,
Source§fn override_response_header<M>(
self,
header_name: HeaderName,
make: M,
) -> SetResponseHeader<Self, M>where
Self: Sized,
fn override_response_header<M>(
self,
header_name: HeaderName,
make: M,
) -> SetResponseHeader<Self, M>where
Self: Sized,
Source§fn append_response_header<M>(
self,
header_name: HeaderName,
make: M,
) -> SetResponseHeader<Self, M>where
Self: Sized,
fn append_response_header<M>(
self,
header_name: HeaderName,
make: M,
) -> SetResponseHeader<Self, M>where
Self: Sized,
Source§fn insert_response_header_if_not_present<M>(
self,
header_name: HeaderName,
make: M,
) -> SetResponseHeader<Self, M>where
Self: Sized,
fn insert_response_header_if_not_present<M>(
self,
header_name: HeaderName,
make: M,
) -> SetResponseHeader<Self, M>where
Self: Sized,
Source§fn set_request_id<M>(
self,
header_name: HeaderName,
make_request_id: M,
) -> SetRequestId<Self, M>where
Self: Sized,
M: MakeRequestId,
fn set_request_id<M>(
self,
header_name: HeaderName,
make_request_id: M,
) -> SetRequestId<Self, M>where
Self: Sized,
M: MakeRequestId,
Source§fn set_x_request_id<M>(self, make_request_id: M) -> SetRequestId<Self, M>where
Self: Sized,
M: MakeRequestId,
fn set_x_request_id<M>(self, make_request_id: M) -> SetRequestId<Self, M>where
Self: Sized,
M: MakeRequestId,
x-request-id as the header name. Read moreSource§fn propagate_request_id(
self,
header_name: HeaderName,
) -> PropagateRequestId<Self>where
Self: Sized,
fn propagate_request_id(
self,
header_name: HeaderName,
) -> PropagateRequestId<Self>where
Self: Sized,
Source§fn propagate_x_request_id(self) -> PropagateRequestId<Self>where
Self: Sized,
fn propagate_x_request_id(self) -> PropagateRequestId<Self>where
Self: Sized,
x-request-id as the header name. Read moreSource§fn catch_panic(self) -> CatchPanic<Self, DefaultResponseForPanic>where
Self: Sized,
fn catch_panic(self) -> CatchPanic<Self, DefaultResponseForPanic>where
Self: Sized,
500 Internal Server responses. Read moreSource§fn request_body_limit(self, limit: usize) -> RequestBodyLimit<Self>where
Self: Sized,
fn request_body_limit(self, limit: usize) -> RequestBodyLimit<Self>where
Self: Sized,
413 Payload Too Large responses. Read more