pub struct Metadata {Show 22 fields
pub title: Option<String>,
pub title_template: Option<String>,
pub title_absolute: bool,
pub description: Option<String>,
pub keywords: Option<Vec<String>>,
pub authors: Option<Vec<String>>,
pub canonical: Option<String>,
pub robots: Option<String>,
pub viewport: Option<String>,
pub theme_color: Option<String>,
pub color_scheme: Option<String>,
pub manifest: Option<String>,
pub icons: Option<Vec<Icon>>,
pub open_graph: Option<OpenGraph>,
pub twitter: Option<Twitter>,
pub alternates: Option<Vec<(String, String)>>,
pub other: Vec<(String, String)>,
pub stylesheets: Vec<String>,
pub preloads: Vec<Preload>,
pub links: Vec<LinkTag>,
pub html_attributes: Vec<(String, String)>,
pub theme_colors: Vec<(String, String)>,
}Fields§
§title: Option<String>§title_template: Option<String>Applied to descendant titles; %s is replaced by the child title.
title_absolute: boolWhen true, this title ignores ancestor templates.
description: Option<String>§keywords: Option<Vec<String>>§canonical: Option<String>§robots: Option<String>§viewport: Option<String>§theme_color: Option<String>§color_scheme: Option<String>§manifest: Option<String>§icons: Option<Vec<Icon>>§open_graph: Option<OpenGraph>§twitter: Option<Twitter>§alternates: Option<Vec<(String, String)>>hreflang alternates: (language, url).
other: Vec<(String, String)>Extra <meta name=.. content=..> entries.
stylesheets: Vec<String>External stylesheets (<link rel="stylesheet">).
preloads: Vec<Preload>Preloaded resources (fonts, images).
links: Vec<LinkTag>Extra <link> tags: feeds, preconnect, me, …
html_attributes: Vec<(String, String)>Attributes of the <html> element: (name, value).
theme_colors: Vec<(String, String)>theme-color per media query: (media, color).
Implementations§
Source§impl Metadata
impl Metadata
pub fn new() -> Metadata
pub fn title(self, v: impl Into<String>) -> Metadata
pub fn title_template(self, v: impl Into<String>) -> Metadata
pub fn description(self, v: impl Into<String>) -> Metadata
pub fn canonical(self, v: impl Into<String>) -> Metadata
pub fn robots(self, v: impl Into<String>) -> Metadata
pub fn viewport(self, v: impl Into<String>) -> Metadata
pub fn theme_color(self, v: impl Into<String>) -> Metadata
pub fn color_scheme(self, v: impl Into<String>) -> Metadata
pub fn manifest(self, v: impl Into<String>) -> Metadata
Sourcepub fn absolute_title(self, v: impl Into<String>) -> Metadata
pub fn absolute_title(self, v: impl Into<String>) -> Metadata
A title that ignores ancestor templates.
pub fn keywords<I, S>(self, v: I) -> Metadata
pub fn icon(self, href: impl Into<String>) -> Metadata
Sourcepub fn icon_sized(
self,
href: impl Into<String>,
sizes: impl Into<String>,
mime: impl Into<String>,
) -> Metadata
pub fn icon_sized( self, href: impl Into<String>, sizes: impl Into<String>, mime: impl Into<String>, ) -> Metadata
An icon with its size and type, for browsers that pick one of several:
icon_sized("/favicon-32x32.png", "32x32", "image/png").
Sourcepub fn theme_color_for(
self,
media: impl Into<String>,
color: impl Into<String>,
) -> Metadata
pub fn theme_color_for( self, media: impl Into<String>, color: impl Into<String>, ) -> Metadata
A theme-color for one media query, typically once for each color
scheme: theme_color_for("(prefers-color-scheme: dark)", "#0d1b2a").
A plain theme_color is still written first, for
browsers that ignore media. A child that sets any replaces the
parent’s list.
pub fn apple_touch_icon(self, href: impl Into<String>) -> Metadata
pub fn open_graph(self, og: OpenGraph) -> Metadata
pub fn twitter(self, tw: Twitter) -> Metadata
pub fn alternate( self, lang: impl Into<String>, href: impl Into<String>, ) -> Metadata
pub fn meta( self, name: impl Into<String>, content: impl Into<String>, ) -> Metadata
pub fn stylesheet(self, href: impl Into<String>) -> Metadata
Sourcepub fn preload_font(self, href: impl Into<String>) -> Metadata
pub fn preload_font(self, href: impl Into<String>) -> Metadata
Preload a font file (adds crossorigin, required for fonts).
pub fn preload_image(self, href: impl Into<String>) -> Metadata
Sourcepub fn link(self, rel: impl Into<String>, href: impl Into<String>) -> Metadata
pub fn link(self, rel: impl Into<String>, href: impl Into<String>) -> Metadata
A <link> tag: link("preconnect", "https://cdn.example.com").
Sourcepub fn html_attribute(
self,
name: impl Into<String>,
value: impl Into<String>,
) -> Metadata
pub fn html_attribute( self, name: impl Into<String>, value: impl Into<String>, ) -> Metadata
An attribute of the <html> element, e.g. html_attribute("data-theme", "ocean")
or html_attribute("class", "dark"), so a theme applies before any
script runs. lang overrides [app] lang for the page.
The element is written with the document: client-side navigations keep
the attributes the page already has (and what scripts changed since).
Names that are not valid attribute names and event handlers (on*) are
never rendered; values are escaped, and class gets the same short
names as every other class in release builds.
Sourcepub fn feed(
self,
title: impl Into<String>,
href: impl Into<String>,
mime: impl Into<String>,
) -> Metadata
pub fn feed( self, title: impl Into<String>, href: impl Into<String>, mime: impl Into<String>, ) -> Metadata
A feed readers can subscribe to. Browsers and feed readers look for
rel="alternate" with a feed media type:
feed("RSS", "/feed.xml", "application/rss+xml").
Sourcepub fn render_head(&self) -> String
pub fn render_head(&self) -> String
Render <head> contents.
Trait Implementations§
impl Eq for Metadata
impl StructuralPartialEq for Metadata
Auto Trait Implementations§
impl Forget for Metadata
impl Freeze for Metadata
impl Move for Metadata
impl RefUnwindSafe for Metadata
impl Send for Metadata
impl Sync for Metadata
impl Unpin for Metadata
impl UnsafeUnpin for Metadata
impl UnwindSafe for Metadata
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
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.