From c8cf7919dc8d8d4e42a850463f301f9aea62525e Mon Sep 17 00:00:00 2001 From: prescientmoon <git@moonythm.dev> Date: Mon, 24 Mar 2025 00:42:03 +0100 Subject: [PATCH] Add compact post support --- src/html.rs | 4 +++- src/metadata.rs | 5 +++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/html.rs b/src/html.rs index 600fda6..68da96e 100644 --- a/src/html.rs +++ b/src/html.rs @@ -133,7 +133,9 @@ impl<'s> Writer<'s> { // {{{ Section Container::Section { id } => { if self.metadata.title.id == *id { - if matches!(self.metadata.route, PageRoute::Post(_)) { + if matches!(self.metadata.route, PageRoute::Post(_)) + && !self.metadata.config.compact + { let mut renderer = template!("templates/post.html", out)?; assert_eq!(renderer.current(), Some("attrs")); diff --git a/src/metadata.rs b/src/metadata.rs index 78cc5f0..b929580 100644 --- a/src/metadata.rs +++ b/src/metadata.rs @@ -28,6 +28,10 @@ pub struct PageConfig { #[serde(default)] pub draft: bool, + + /// Hides away the traditional header + #[serde(default)] + pub compact: bool, } impl PageConfig { @@ -73,6 +77,7 @@ impl PageConfig { self.sitemap_exclude |= other.sitemap_exclude; self.hidden |= other.hidden; self.draft |= other.draft; + self.compact |= other.compact; Ok(()) }