Skip to content

Commit 843ffeb

Browse files
jmooringbep
authored andcommitted
resources/page: Respect disablePathToLower for permalink tokens
Fixes #13755
1 parent bff5d19 commit 843ffeb

File tree

2 files changed

+28
-1
lines changed

2 files changed

+28
-1
lines changed

‎resources/page/permalinks.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ func (l PermalinkExpander) pageToPermalinkSections(p Page, _ string) (string, er
311311

312312
// pageToPermalinkContentBaseName returns the URL-safe form of the content base name.
313313
func (l PermalinkExpander) pageToPermalinkContentBaseName(p Page, _ string) (string, error) {
314-
return l.urlize(p.PathInfo().BaseNameNoIdentifier()), nil
314+
return l.urlize(p.PathInfo().Unnormalized().BaseNameNoIdentifier()), nil
315315
}
316316

317317
// pageToPermalinkSlugOrContentBaseName returns the URL-safe form of the slug, content base name.

‎resources/page/permalinks_integration_test.go‎

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
package page_test
1515

1616
import (
17+
"strings"
1718
"testing"
1819

1920
"github.com/bep/logg"
@@ -343,3 +344,29 @@ slug: "c2slug"
343344
b.AssertFileContent("public/myc/c1/index.html", "C1|/myc/c1/|term|")
344345
b.AssertFileContent("public/myc/c2slug/index.html", "C2|/myc/c2slug/|term|")
345346
}
347+
348+
func TestIssue13755(t *testing.T) {
349+
t.Parallel()
350+
351+
files := `
352+
-- hugo.toml --
353+
disableKinds = ['home','rss','section','sitemap','taxonomy','term']
354+
disablePathToLower = false
355+
[permalinks.page]
356+
s1 = "/:contentbasename"
357+
-- content/s1/aBc.md --
358+
---
359+
title: aBc
360+
---
361+
-- layouts/all.html --
362+
{{ .Title }}
363+
`
364+
365+
b := hugolib.Test(t, files)
366+
b.AssertFileExists("public/abc/index.html", true)
367+
368+
files = strings.ReplaceAll(files, "disablePathToLower = false", "disablePathToLower = true")
369+
370+
b = hugolib.Test(t, files)
371+
b.AssertFileExists("public/aBc/index.html", true)
372+
}

0 commit comments

Comments
 (0)