diff --git a/components/config/src/config/mod.rs b/components/config/src/config/mod.rs index b8deb6c44..604d6fbb7 100644 --- a/components/config/src/config/mod.rs +++ b/components/config/src/config/mod.rs @@ -204,6 +204,7 @@ impl Config { let trailing_bit = if path.ends_with('/') || self.feed_filenames.iter().any(|feed_filename| path.ends_with(feed_filename)) || path.is_empty() + || path.contains("#") { "" } else { @@ -584,6 +585,13 @@ hello = "world" assert_eq!(config.make_permalink("atom.xml"), "http://vincent.is/atom.xml"); } + // https://github.com/getzola/zola/issues/2676 + #[test] + fn permalink_with_anchor() { + let config = Config { base_url: "http://vincent.is".to_string(), ..Default::default() }; + assert_eq!(config.make_permalink("/about#me"), "http://vincent.is/about#me"); + } + #[test] fn can_merge_with_theme_data_and_preserve_config_value() { let config_str = r#"