Struct mdblog::Post
[−]
[src]
pub struct Post { pub path: PathBuf, // some fields omitted }
blog post object
every blog post is composed of head
part and body
part.
the two part is separated by the first blank line.
the blog header part supported headers:
- date: the publish datetime, required,
date: 1970-01-01 00:00:00
- tags: the tags of blog post, required,
tags: hello, world
- hidden: whether hidden blog post or not, optional, default
true
,hidden: false
Fields
path: PathBuf
relative path of post from blog root directory
Methods
impl Post
[src]
pub fn new<P: AsRef<Path>>(root: P, path: P) -> Post
[src]
pub fn src(&self) -> PathBuf
[src]
the absolute path of blog post markdown file
pub fn dest(&self) -> PathBuf
[src]
the absolute path of blog post html file
pub fn title(&self) -> &str
[src]
blog title
pub fn datetime(&self) -> DateTime<Local>
[src]
blog publish time
[src]
wether blog post is hidden or not
pub fn url(&self) -> PathBuf
[src]
the post url
pub fn content(&self) -> String
[src]
the rendered html content of post body port
[src]
the post tags
pub fn map(&self) -> Map<String, Value>
[src]
post context for render
pub fn load(&mut self) -> Result<()>
[src]
load post head part and body part