Skip to content

Commit

Permalink
Handle permalink with anchor (doesn't add trailing slash) (#2779)
Browse files Browse the repository at this point in the history
Co-authored-by: Gregory Soutade <[email protected]>
  • Loading branch information
soutade and Gregory Soutade authored Jan 21, 2025
1 parent 3294bc0 commit d7d7d95
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions components/config/src/config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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#"
Expand Down

0 comments on commit d7d7d95

Please sign in to comment.