Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

resources/page: Escaping colon in front matter url doesn't work with section pages #12954

Closed
Tracked by #2737
jmooring opened this issue Oct 16, 2024 · 1 comment · Fixed by #12955
Closed
Tracked by #2737
Assignees
Milestone

Comments

@jmooring
Copy link
Member

jmooring commented Oct 16, 2024

content/s1/_index.md

---
title: s1
url: "/a\\:b/:slug/"
---

The published path does not have a colon. It is public/ab/s1/index.html instead of public/a:b/s1/index.html.

I have modified the existing integration test to include this case:

// Issue 12948.
// Issue 12954.
func TestPermalinksWithEscapedColons(t *testing.T) {
	t.Parallel()

	if htesting.IsWindows() {
		t.Skip("Windows does not support colons in paths")
	}

	files := `
-- hugo.toml --
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
url: "/a\\:b/:slug/"
---
-- content/s2/p2.md --
---
title: p2
---
-- 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 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)
}
@bep bep added this to the v0.136.1 milestone Oct 16, 2024
@bep bep self-assigned this Oct 16, 2024
@bep bep removed the NeedsTriage label Oct 16, 2024
bep added a commit to bep/hugo that referenced this issue Oct 16, 2024
bep added a commit to bep/hugo that referenced this issue Oct 16, 2024
bep added a commit to bep/hugo that referenced this issue Oct 16, 2024
@bep bep closed this as completed in e4ad0c5 Oct 16, 2024
Copy link

github-actions bot commented Nov 7, 2024

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 7, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants