From 7cff1d335cc15e73b349043b77204a9fb90bf6c4 Mon Sep 17 00:00:00 2001 From: Anton Lazarev Date: Thu, 6 Dec 2018 20:06:54 -0500 Subject: [PATCH 1/2] add rendering for 404.html when running zola serve --- components/rebuild/src/lib.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/components/rebuild/src/lib.rs b/components/rebuild/src/lib.rs index dad6ede..ddc9668 100644 --- a/components/rebuild/src/lib.rs +++ b/components/rebuild/src/lib.rs @@ -352,6 +352,7 @@ pub fn after_template_change(site: &mut Site, path: &Path) -> Result<()> { site.render_orphan_pages() } "section.html" => site.render_sections(), + "404.html" => site.render_404(), // Either the index or some unknown template changed // We can't really know what this change affects so rebuild all // the things From 885c7ded80d4fd638e88b0e0133fcd581b387df9 Mon Sep 17 00:00:00 2001 From: Anton Lazarev Date: Fri, 7 Dec 2018 20:47:01 -0500 Subject: [PATCH 2/2] inject livereloader for 404 template --- components/site/src/lib.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/components/site/src/lib.rs b/components/site/src/lib.rs index 7624022..61c4248 100644 --- a/components/site/src/lib.rs +++ b/components/site/src/lib.rs @@ -627,9 +627,10 @@ impl Site { ensure_directory_exists(&self.output_path)?; let mut context = Context::new(); context.insert("config", &self.config); + let output = render_template("404.html", &self.tera, &context, &self.config.theme)?; create_file( &self.output_path.join("404.html"), - &render_template("404.html", &self.tera, &context, &self.config.theme)?, + &self.inject_livereload(output), ) }