pub struct BaseTemplateData { /* private fields */ }Expand description
Per-server template data.
Built once at boot and held in the server’s state. Everything on it can be
overridden for a single page by PageTemplateData,
except the fields that identify the site itself.
Implementations§
Source§impl BaseTemplateData
impl BaseTemplateData
Sourcepub fn new(params: BaseTemplateDataParams) -> Self
pub fn new(params: BaseTemplateDataParams) -> Self
Builds base data with every field supplied.
Two paths are normalised on the way in. A trailing slash on base_url
is stripped, so joining it with a page URL cannot produce
https://example.com//blog. A leading slash on social_image is
stripped, so it keys into the cache-buster map exactly like the
stylesheet and script paths beside it — without that, the social card is
the one asset on the site that can never be content-hashed.
Overrides the author.
Sourcepub fn with_twitter_username(self, twitter_username: impl Into<String>) -> Self
pub fn with_twitter_username(self, twitter_username: impl Into<String>) -> Self
Overrides the Twitter/X handle.
Sourcepub fn with_site_entity(self, site_entity: SiteEntity) -> Self
pub fn with_site_entity(self, site_entity: SiteEntity) -> Self
Overrides who or what the site represents.
Sourcepub fn with_language_code(self, language_code: impl Into<String>) -> Self
pub fn with_language_code(self, language_code: impl Into<String>) -> Self
Overrides the language subtag.
Sourcepub fn with_country_code(self, country_code: impl Into<String>) -> Self
pub fn with_country_code(self, country_code: impl Into<String>) -> Self
Overrides the region subtag.
Sourcepub fn replace_see_also<I, S>(self, see_also: I) -> Self
pub fn replace_see_also<I, S>(self, see_also: I) -> Self
Replaces the og:see_also list wholesale.
For a project that should not carry the author’s personal links at all.
Sourcepub fn extend_see_also<I, S>(self, see_also: I) -> Self
pub fn extend_see_also<I, S>(self, see_also: I) -> Self
Appends to the og:see_also list.
For a project with its own presence alongside the author’s — a band’s
YouTube channel next to a personal one.
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 the site-wide stylesheet list.
Sourcepub fn extend_scripts<I, S>(self, scripts: I) -> Self
pub fn extend_scripts<I, S>(self, scripts: I) -> Self
Appends to the site-wide script list.
Sourcepub fn description(&self) -> &str
pub fn description(&self) -> &str
The default description.
The author.
Sourcepub fn twitter_username(&self) -> &str
pub fn twitter_username(&self) -> &str
The Twitter/X handle.
The default social image.
The default social image alt text.
Sourcepub const fn theme_color(&self) -> &ThemeColor
pub const fn theme_color(&self) -> &ThemeColor
The browser-chrome colour and supported schemes.
Sourcepub const fn site_entity(&self) -> &SiteEntity
pub const fn site_entity(&self) -> &SiteEntity
Who or what the site represents.
Sourcepub const fn theme_script(&self) -> ThemeScript
pub const fn theme_script(&self) -> ThemeScript
The pre-paint theme script this site’s design implies.
Sourcepub fn language_code(&self) -> &str
pub fn language_code(&self) -> &str
The language subtag.
Sourcepub fn country_code(&self) -> &str
pub fn country_code(&self) -> &str
The region subtag.
Sourcepub fn copyright_start(&self) -> &str
pub fn copyright_start(&self) -> &str
The first year of the copyright range.
Sourcepub fn style_sheets(&self) -> &[String]
pub fn style_sheets(&self) -> &[String]
The site-wide stylesheets.
Source§impl BaseTemplateData
impl BaseTemplateData
Sourcepub fn goddtriffin(params: GoddtriffinParams) -> Self
pub fn goddtriffin(params: GoddtriffinParams) -> Self
Base data pre-filled with Todd Everett Griffin’s defaults.
Fills in author, language, region, Twitter/X handle,
GODDTRIFFIN_SEE_ALSO and a Person site entity, and derives
social_image_alt as "{project}: {description}". Everything else is
required, because it differs per project.
A project that is not him — a band, a business — should call
with_site_entity with an
Organization, because the entity node is a
factual claim search engines reconcile against.
To change what the preset filled in, call
replace_see_also,
extend_see_also, or one of the with_*
methods on the returned value.
Trait Implementations§
Source§impl Clone for BaseTemplateData
impl Clone for BaseTemplateData
Source§impl Debug for BaseTemplateData
impl Debug for BaseTemplateData
Source§impl<'de> Deserialize<'de> for BaseTemplateData
impl<'de> Deserialize<'de> for BaseTemplateData
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for BaseTemplateData
Source§impl PartialEq for BaseTemplateData
impl PartialEq for BaseTemplateData
Source§impl Serialize for BaseTemplateData
impl Serialize for BaseTemplateData
impl StructuralPartialEq for BaseTemplateData
Auto Trait Implementations§
impl Freeze for BaseTemplateData
impl RefUnwindSafe for BaseTemplateData
impl Send for BaseTemplateData
impl Sync for BaseTemplateData
impl Unpin for BaseTemplateData
impl UnsafeUnpin for BaseTemplateData
impl UnwindSafe for BaseTemplateData
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,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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