diff --git a/src/post/mod.rs b/src/post/mod.rs index 54e25d7..4bb6d50 100644 --- a/src/post/mod.rs +++ b/src/post/mod.rs @@ -12,7 +12,7 @@ pub struct Post { pub link: String, pub body: String, pub body_html: String, - pub date: NaiveDate, + pub date: DateTime, } impl Into for Post { @@ -22,7 +22,7 @@ impl Into for Post { .content_html(self.body_html) .id(format!("https://christine.website/{}", self.link)) .url(format!("https://christine.website/{}", self.link)) - .date_published(self.front_matter.date); + .date_published(self.date.to_rfc3339()); let mut tags: Vec = vec![]; @@ -62,14 +62,7 @@ impl Into for Post { link.href = format!("https://christine.website/{}", self.link); result.links(vec![link]); result.content(content); - result.published(Some( - DateTime::::from_utc( - NaiveDateTime::new(self.date, NaiveTime::from_hms(0, 0, 0)), - Utc, - ) - .with_timezone(&Utc) - .into(), - )); + result.published(self.date); result.build().unwrap() } @@ -83,9 +76,9 @@ impl Into for Post { result.title(Some(self.front_matter.title)); result.link(format!("https://christine.website/{}", self.link)); result.guid(guid); - result.author(Some("me@christine.website".to_string())); + result.author(Some("Christine Dodrill ".to_string())); result.content(self.body_html); - result.pub_date(self.front_matter.date); + result.pub_date(self.date.to_rfc2822()); result.build().unwrap() } @@ -117,7 +110,14 @@ pub fn load(dir: &str) -> Result> { link: format!("{}/{}", dir, path.file_stem().unwrap().to_str().unwrap()), body: markup.to_string(), body_html: crate::app::markdown(&markup), - date: date, + date: { + DateTime::::from_utc( + NaiveDateTime::new(date, NaiveTime::from_hms(0, 0, 0)), + Utc, + ) + .with_timezone(&Utc) + .into() + }, }) }