Browse Source

Do not have trailing slash for rss.xml

Closes #486
index-subcmd
Vincent Prouillet 5 years ago
parent
commit
dffd39aa8f
2 changed files with 10 additions and 1 deletions
  1. +1
    -0
      CHANGELOG.md
  2. +9
    -1
      components/config/src/config.rs

+ 1
- 0
CHANGELOG.md View File

@@ -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)



+ 9
- 1
components/config/src/config.rs View File

@@ -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#"


Loading…
Cancel
Save