Skip to content

Commit bf1d20d

Browse files
committed
Revert "resources/page: Fix slugorcontentbasename for section pages"
This reverts commit 25c7c18. See #14104 See #14325
1 parent 1deec99 commit bf1d20d

File tree

2 files changed

+0
-41
lines changed

2 files changed

+0
-41
lines changed

‎resources/page/permalinks.go‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -336,11 +336,6 @@ func (l PermalinkExpander) pageToPermalinkSectionSlugs(p Page, attr string) (str
336336

337337
// pageToPermalinkContentBaseName returns the URL-safe form of the content base name.
338338
func (l PermalinkExpander) pageToPermalinkContentBaseName(p Page, _ string) (string, error) {
339-
// For section pages with _index.md files, return empty string to match the behavior of pageToPermalinkFilename.
340-
// Sections without files should use their directory name.
341-
if p.PathInfo().IsBranchBundle() && p.File() != nil {
342-
return "", nil
343-
}
344339
return l.urlize(p.PathInfo().Unnormalized().BaseNameNoIdentifier()), nil
345340
}
346341

‎resources/page/permalinks_integration_test.go‎

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -457,39 +457,3 @@ title: aBc
457457
b = hugolib.Test(t, files)
458458
b.AssertFileExists("public/aBc/index.html", true)
459459
}
460-
461-
// Issue 14104
462-
func TestIssue14104(t *testing.T) {
463-
t.Parallel()
464-
465-
files := `
466-
-- hugo.toml --
467-
[permalinks.page]
468-
foo = "/:sections[1:]/:slugorcontentbasename/"
469-
[permalinks.section]
470-
foo = "/:sections[1:]/:slugorcontentbasename/"
471-
-- content/foo/_index.md --
472-
---
473-
title: Foo
474-
---
475-
-- content/foo/bar/_index.md --
476-
---
477-
title: Bar
478-
---
479-
-- content/foo/bar/somepage.md --
480-
---
481-
title: Some Page
482-
---
483-
-- layouts/list.html --
484-
List|{{ .Kind }}|{{ .RelPermalink }}|
485-
-- layouts/single.html --
486-
Single|{{ .Kind }}|{{ .RelPermalink }}|
487-
`
488-
489-
b := hugolib.Test(t, files)
490-
491-
// Section page should be at /bar/index.html, not /bar/bar/index.html
492-
b.AssertFileContent("public/bar/index.html", "List|section|/bar/|")
493-
// Regular page should be at /bar/somepage/index.html
494-
b.AssertFileContent("public/bar/somepage/index.html", "Single|page|/bar/somepage/|")
495-
}

0 commit comments

Comments
 (0)