Browse Source

Merge pull request #550 from antonok-edm/next

add rendering for 404.html when running zola serve
index-subcmd
Vincent Prouillet GitHub 6 years ago
parent
commit
daf1b4d92b
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 1 deletions
  1. +1
    -0
      components/rebuild/src/lib.rs
  2. +2
    -1
      components/site/src/lib.rs

+ 1
- 0
components/rebuild/src/lib.rs View File

@@ -352,6 +352,7 @@ pub fn after_template_change(site: &mut Site, path: &Path) -> Result<()> {
site.render_orphan_pages() site.render_orphan_pages()
} }
"section.html" => site.render_sections(), "section.html" => site.render_sections(),
"404.html" => site.render_404(),
// Either the index or some unknown template changed // Either the index or some unknown template changed
// We can't really know what this change affects so rebuild all // We can't really know what this change affects so rebuild all
// the things // the things


+ 2
- 1
components/site/src/lib.rs View File

@@ -627,9 +627,10 @@ impl Site {
ensure_directory_exists(&self.output_path)?; ensure_directory_exists(&self.output_path)?;
let mut context = Context::new(); let mut context = Context::new();
context.insert("config", &self.config); context.insert("config", &self.config);
let output = render_template("404.html", &self.tera, &context, &self.config.theme)?;
create_file( create_file(
&self.output_path.join("404.html"), &self.output_path.join("404.html"),
&render_template("404.html", &self.tera, &context, &self.config.theme)?,
&self.inject_livereload(output),
) )
} }




Loading…
Cancel
Save