Merge pull request #164 from jeffparsons/expose_page_draft_variable

Expose to templates whether or not a page is draft
This commit is contained in:
Vincent Prouillet 2017-11-01 14:52:14 +01:00 committed by GitHub
commit 4783782798
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -203,7 +203,7 @@ impl Default for Page {
impl ser::Serialize for Page { impl ser::Serialize for Page {
fn serialize<S>(&self, serializer: S) -> StdResult<S::Ok, S::Error> where S: ser::Serializer { fn serialize<S>(&self, serializer: S) -> StdResult<S::Ok, S::Error> where S: ser::Serializer {
let mut state = serializer.serialize_struct("page", 17)?; let mut state = serializer.serialize_struct("page", 18)?;
state.serialize_field("content", &self.content)?; state.serialize_field("content", &self.content)?;
state.serialize_field("title", &self.meta.title)?; state.serialize_field("title", &self.meta.title)?;
state.serialize_field("description", &self.meta.description)?; state.serialize_field("description", &self.meta.description)?;
@ -222,6 +222,7 @@ impl ser::Serialize for Page {
state.serialize_field("previous", &self.previous)?; state.serialize_field("previous", &self.previous)?;
state.serialize_field("next", &self.next)?; state.serialize_field("next", &self.next)?;
state.serialize_field("toc", &self.toc)?; state.serialize_field("toc", &self.toc)?;
state.serialize_field("draft", &self.is_draft())?;
state.end() state.end()
} }
} }