// if page URL is explicitly set in frontmatter,
// preserve its value without sanitization
- if d.Kind != kinds.KindPage || d.URL == "" {
+ if d.URL == "" {
// Note: MakePathSanitized will lower case the path if
// disablePathToLower isn't set.
pb.Sanitize()
}
// Issue 12948.
+// Issue 12954.
func TestPermalinksWithEscapedColons(t *testing.T) {
t.Parallel()
files := `
-- hugo.toml --
-disableKinds = ['home','rss','section','sitemap','taxonomy','term']
+disableKinds = ['home','rss','sitemap','taxonomy','term']
[permalinks.page]
s2 = "/c\\:d/:slug/"
+-- content/s1/_index.md --
+---
+title: s1
+url: "/a\\:b/:slug/"
+---
-- content/s1/p1.md --
---
title: p1
---
-- layouts/_default/single.html --
{{ .Title }}
+-- layouts/_default/list.html --
+{{ .Title }}
`
b := hugolib.Test(t, files)
b.AssertFileExists("public/a:b/p1/index.html", true)
+ b.AssertFileExists("public/a:b/s1/index.html", true)
- // The above URL comes from the URL front matter field where everything is allowed.
+ // The above URLs come from the URL front matter field where everything is allowed.
// We strip colons from paths constructed by Hugo (they are not supported on Windows).
b.AssertFileExists("public/cd/p2/index.html", true)
}