pub struct Post {
pub file_path: PathBuf,
pub url: Url,
pub title: String,
pub date: String,
pub body: String,
pub tags: HashSet<Tag>,
}
Expand description
Represents a blog post.
Fields§
§file_path: PathBuf
The output path where the final post file will be rendered.
url: Url
The address for the rendered post.
title: String
The title of the post.
date: String
The date of the post.
body: String
The body of the post.
The tags associated with the post.
Implementations§
Source§impl Post
impl Post
Sourcepub fn to_value(&self) -> Value
pub fn to_value(&self) -> Value
Converts a Post
into a template-renderable Value
, representing
a full post (as opposed to Post::summarize
which represents a
post summary). The resulting Value
has fields:
url
: The url of the posttitle
: The title of the postdate
: The published date of the postbody
: The post bodytags
: A list of tags associated with the post
Sourcepub fn summary(&self) -> (&str, bool)
pub fn summary(&self) -> (&str, bool)
Returns the full post body unless a <!-- more -->
tag was found, in
which case it returns the text up to that tag (the “summary” text). It
also returns a boolean value indicating whether or not the tag was
found.
Sourcepub fn summarize(&self) -> Value
pub fn summarize(&self) -> Value
Converts a Post
into a template-renderable Value
representing a
post summary. The resulting Value
has fields:
url
: The url of the posttitle
: The title of the postdate
: The published date of the postsummary
: The post summary if there is a<!-- more -->
tag or else the full post bodysummarized
: A boolean value representing whether or not a<!-- more -->
tag was found and thus the post was truncated.tags
: A list of tags associated with the post
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Post
impl RefUnwindSafe for Post
impl Send for Post
impl Sync for Post
impl Unpin for Post
impl UnwindSafe for Post
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