pub struct MetaTags {
pub title: Option<String>,
pub description: Option<String>,
pub canonical: Option<Url>,
pub robots: Option<String>,
pub language: Option<String>,
pub charset: Option<String>,
pub viewport: Option<String>,
pub og: OpenGraphTags,
pub twitter: TwitterTags,
pub hreflang: Vec<HreflangTag>,
}Expand description
Complete set of meta tags extracted from a page.
Aggregates all SEO-relevant meta information including title, description, canonical URL, robots directives, Open Graph, Twitter Cards, and hreflang tags. Provides helper methods for common checks.
§Examples
use crawlkit_engine::MetaTags;
let meta = MetaTags {
title: Some("My Page".to_string()),
robots: Some("noindex, nofollow".to_string()),
..Default::default()
};
assert!(meta.is_noindex());
assert!(meta.is_nofollow());
assert_eq!(meta.title_length(), Some(7));Fields§
§title: Option<String>Page title (<title> tag).
description: Option<String>Meta description.
canonical: Option<Url>Canonical URL (<link rel="canonical">).
robots: Option<String>Robots directive (<meta name="robots">).
language: Option<String>Page language (<html lang="...">).
charset: Option<String>Character encoding (<meta charset="...">).
viewport: Option<String>Viewport meta tag.
og: OpenGraphTagsOpen Graph tags.
twitter: TwitterTagsTwitter Card tags.
hreflang: Vec<HreflangTag>Hreflang alternate links.
Implementations§
Source§impl MetaTags
impl MetaTags
Sourcepub fn title_length(&self) -> Option<usize>
pub fn title_length(&self) -> Option<usize>
Returns the length of the title, if present.
Sourcepub fn description_length(&self) -> Option<usize>
pub fn description_length(&self) -> Option<usize>
Returns the length of the description, if present.
Sourcepub fn is_noindex(&self) -> bool
pub fn is_noindex(&self) -> bool
Whether the page has a <meta name="robots" content="noindex"> directive.
Sourcepub fn is_nofollow(&self) -> bool
pub fn is_nofollow(&self) -> bool
Whether the page has a <meta name="robots" content="nofollow"> directive.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for MetaTags
impl<'de> Deserialize<'de> for MetaTags
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>,
Auto Trait Implementations§
impl Freeze for MetaTags
impl RefUnwindSafe for MetaTags
impl Send for MetaTags
impl Sync for MetaTags
impl Unpin for MetaTags
impl UnsafeUnpin for MetaTags
impl UnwindSafe for MetaTags
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<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> 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>
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>
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