Pass lang to 404

Closes #1281
This commit is contained in:
Vincent Prouillet 2021-01-09 10:21:47 +01:00
parent 819cfc8ec2
commit 779a15a500
2 changed files with 3 additions and 1 deletions

View file

@ -1,6 +1,6 @@
# Changelog # Changelog
## 0.13.0 (unreleased) ## 0.13.0 (2021-01-09)
- Enable HTML minification - Enable HTML minification
- Support `output_dir` in `config.toml` - Support `output_dir` in `config.toml`
@ -22,6 +22,7 @@ content
- Update clojure syntax - Update clojure syntax
- Prefer extra syntaxes to the default ones if we have a match for language - Prefer extra syntaxes to the default ones if we have a match for language
- Fix `zola serve` having issues with non-ascii paths - Fix `zola serve` having issues with non-ascii paths
- 404 page now gets the site default language as `lang`
## 0.12.2 (2020-09-28) ## 0.12.2 (2020-09-28)

View file

@ -770,6 +770,7 @@ 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);
context.insert("lang", &self.config.default_language);
let output = render_template("404.html", &self.tera, context, &self.config.theme)?; let output = render_template("404.html", &self.tera, context, &self.config.theme)?;
let content = self.inject_livereload(output); let content = self.inject_livereload(output);
self.write_content(&[], "404.html", content, false)?; self.write_content(&[], "404.html", content, false)?;