Fix config data not getting to the templates

Closes #1687
This commit is contained in:
Vincent Prouillet 2021-12-07 20:54:38 +01:00
parent 9191a2726c
commit 7ce4f75d09
2 changed files with 16 additions and 4 deletions

View file

@ -3,6 +3,7 @@
## 0.15.1 (unreleased)
- Fix markdown shortcodes not being rendered correctly
- Fix config data not getting to the templates
## 0.15.0 (2021-12-05)

View file

@ -332,7 +332,7 @@ pub fn merge(into: &mut Toml, from: &Toml) -> Result<()> {
impl Default for Config {
fn default() -> Config {
let mut conf = Config {
Config {
base_url: DEFAULT_BASE_URL.to_string(),
title: None,
description: None,
@ -357,9 +357,7 @@ impl Default for Config {
search: search::Search::default(),
markdown: markup::Markdown::default(),
extra: HashMap::new(),
};
conf.add_default_language();
conf
}
}
}
@ -707,4 +705,17 @@ highlight_themes_css = [
let config = Config::parse(config);
assert_eq!(config.is_err(), true);
}
// https://github.com/getzola/zola/issues/1687
#[test]
fn regression_config_default_lang_data() {
let config = r#"
base_url = "https://www.getzola.org/"
title = "Zola"
"#;
let config = Config::parse(config).unwrap();
let serialised = config.serialize(&config.default_language);
assert_eq!(serialised.title, &config.title);
}
}