From 7c3a112d7d7416a953ee1b47eadabb6917bf8eed Mon Sep 17 00:00:00 2001 From: Vincent Prouillet Date: Fri, 12 Jul 2019 23:47:15 +0200 Subject: [PATCH] Render draft pages in serve mode --- CHANGELOG.md | 3 ++- components/site/src/lib.rs | 3 ++- src/cmd/serve.rs | 1 + 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a8839baf..26011827 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,8 +6,9 @@ - Fix sitemaps namespace - Update livereload - Add `hard_link_static` config option to hard link things in the static directory instead of copying -- Draft pages are not longer rendered +- Draft pages are not longer rendered in `zola build` - Add warning for old style internal links since they would still function +- Add some counts to `zola check` ## 0.8.0 (2019-06-22) diff --git a/components/site/src/lib.rs b/components/site/src/lib.rs index 262d4a4b..65011a30 100644 --- a/components/site/src/lib.rs +++ b/components/site/src/lib.rs @@ -229,7 +229,8 @@ impl Site { let mut pages_insert_anchors = HashMap::new(); for page in pages { let p = page?; - if p.meta.draft { + // Draft pages are not rendered in zola build so we just discard them + if p.meta.draft && self.config.is_in_build_mode() { continue; } pages_insert_anchors.insert( diff --git a/src/cmd/serve.rs b/src/cmd/serve.rs index ab6cbeff..7b1627f8 100644 --- a/src/cmd/serve.rs +++ b/src/cmd/serve.rs @@ -130,6 +130,7 @@ fn create_new_site( format!("http://{}", base_address) }; + site.config.enable_serve_mode(); site.set_base_url(base_url); site.set_output_path(output_dir); site.load()?;