diff --git a/CHANGELOG.md b/CHANGELOG.md index e5e9ba4..cb6ea1b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -32,6 +32,7 @@ Tera function sections up to the index to be used with the `get_section` Tera function - Add a `load_data` Tera function to load local CSV/TOML/JSON files - Add `relative_path` to pages and sections in templates +- Do not have a trailing slash for the RSS permalinks ## 0.4.2 (2018-09-03) diff --git a/components/config/src/config.rs b/components/config/src/config.rs index 47ff3d8..0564dcc 100644 --- a/components/config/src/config.rs +++ b/components/config/src/config.rs @@ -189,7 +189,7 @@ impl Config { /// Makes a url, taking into account that the base url might have a trailing slash pub fn make_permalink(&self, path: &str) -> String { - let trailing_bit = if path.ends_with('/') || path.is_empty() { + let trailing_bit = if path.ends_with('/') || path.ends_with("rss.xml") || path.is_empty() { "" } else { "/" @@ -366,6 +366,14 @@ hello = "world" ); } + // https://github.com/Keats/gutenberg/issues/486 + #[test] + fn doesnt_add_trailing_slash_to_rss() { + let mut config = Config::default(); + config.base_url = "http://vincent.is/".to_string(); + assert_eq!(config.make_permalink("rss.xml"), "http://vincent.is/rss.xml"); + } + #[test] fn can_merge_with_theme_data_and_preserve_config_value() { let config_str = r#"