disable_rss -> generate_rss in config

This commit is contained in:
Vincent Prouillet 2017-03-12 12:59:28 +09:00
parent dde9af3efd
commit 4e99389566
2 changed files with 9 additions and 6 deletions

View file

@ -21,8 +21,9 @@ pub struct Config {
pub description: Option<String>, pub description: Option<String>,
/// The language used in the site. Defaults to "en" /// The language used in the site. Defaults to "en"
pub language_code: Option<String>, pub language_code: Option<String>,
/// Whether to disable RSS generation, defaults to false (== generate RSS) /// Whether to generate RSS, defaults to false
pub disable_rss: Option<bool>, pub generate_rss: Option<bool>,
/// All user params set in [extra] in the config /// All user params set in [extra] in the config
pub extra: Option<HashMap<String, Toml>>, pub extra: Option<HashMap<String, Toml>>,
} }
@ -44,8 +45,8 @@ impl Config {
config.highlight_code = Some(false); config.highlight_code = Some(false);
} }
if config.disable_rss.is_none() { if config.generate_rss.is_none() {
config.disable_rss = Some(false); config.generate_rss = Some(false);
} }
Ok(config) Ok(config)
@ -71,7 +72,7 @@ impl Default for Config {
highlight_code: Some(true), highlight_code: Some(true),
description: None, description: None,
language_code: Some("en".to_string()), language_code: Some("en".to_string()),
disable_rss: Some(false), generate_rss: Some(false),
extra: None, extra: None,
} }
} }

View file

@ -229,7 +229,9 @@ impl Site {
self.clean()?; self.clean()?;
self.build_pages()?; self.build_pages()?;
self.render_sitemap()?; self.render_sitemap()?;
if self.config.generate_rss.unwrap() {
self.render_rss_feed()?; self.render_rss_feed()?;
}
self.copy_static_directory() self.copy_static_directory()
} }