pub struct SeoBuilder { /* private fields */ }Expand description
A fluent builder for a page’s whole metadata block.
Implements WINGED_RUST_SPEC.md §6 on top of the functions above.
§Examples
use winged_rust::prelude::*;
use winged_rust::seo::SeoBuilder;
let tags = SeoBuilder::new("RideKeeper", "Motorcycle maintenance companion")
.image("https://ridekeeper.example/og.jpg")
.url("https://ridekeeper.example")
.twitter_site("@micheltlutz")
.build();
let rendered: String = tags.iter().map(Render::render).collect();
assert!(rendered.contains(r#"<meta property="og:title" content="RideKeeper">"#));Implementations§
Source§impl SeoBuilder
impl SeoBuilder
Sourcepub fn new(
page_title: impl Into<String>,
description: impl Into<String>,
) -> Self
pub fn new( page_title: impl Into<String>, description: impl Into<String>, ) -> Self
Starts a metadata block from the two fields every page needs.
Sourcepub fn image(self, image_url: impl Into<String>) -> Self
pub fn image(self, image_url: impl Into<String>) -> Self
Sets the preview image used by both Open Graph and Twitter.
Sets the page author.
Sourcepub fn keywords<S: Into<String>>(
self,
keywords: impl IntoIterator<Item = S>,
) -> Self
pub fn keywords<S: Into<String>>( self, keywords: impl IntoIterator<Item = S>, ) -> Self
Sets the keyword list.
Sourcepub fn twitter_card(self, card: impl Into<String>) -> Self
pub fn twitter_card(self, card: impl Into<String>) -> Self
Overrides the Twitter card type.
Sourcepub fn twitter_site(self, site: impl Into<String>) -> Self
pub fn twitter_site(self, site: impl Into<String>) -> Self
Sets twitter:site.
Sourcepub fn twitter_creator(self, creator: impl Into<String>) -> Self
pub fn twitter_creator(self, creator: impl Into<String>) -> Self
Sets twitter:creator.
Trait Implementations§
Source§impl Clone for SeoBuilder
impl Clone for SeoBuilder
Auto Trait Implementations§
impl Freeze for SeoBuilder
impl RefUnwindSafe for SeoBuilder
impl Send for SeoBuilder
impl Sync for SeoBuilder
impl Unpin for SeoBuilder
impl UnsafeUnpin for SeoBuilder
impl UnwindSafe for SeoBuilder
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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