Repository: gohugoio/hugo (language: go)

Issue:
titleCaseStyle not applied to automatic section pages
`titleCaseStyle` is applied to automatic term and automatic taxonomy pages, but not automatic section pages.

Reference: <https://discourse.gohugo.io/t/46595>



Discussion / hints:

Fix patch:
diff --git a/hugolib/page__meta.go b/hugolib/page__meta.go
index 3781a847ad0..eb1559fb113 100644
--- a/hugolib/page__meta.go
+++ b/hugolib/page__meta.go
@@ -690,13 +690,10 @@ func (p *pageMeta) applyDefaultValues(n *contentNode) error {
 			} else {
 				sectionName = p.sections[0]
 			}
-
-			sectionName = helpers.FirstUpper(sectionName)
 			if p.s.conf.PluralizeListTitles {
-				p.title = flect.Pluralize(sectionName)
-			} else {
-				p.title = sectionName
+				sectionName = flect.Pluralize(sectionName)
 			}
+			p.title = p.s.conf.C.CreateTitle(sectionName)
 		case kinds.KindTerm:
 			// TODO(bep) improve
 			key := p.sections[len(p.sections)-1]


Test patch:
diff --git a/hugolib/integration_test.go b/hugolib/integration_test.go
index 1109694b1f5..93468ecebbb 100644
--- a/hugolib/integration_test.go
+++ b/hugolib/integration_test.go
@@ -114,3 +114,36 @@ func TestRenderStringBadMarkupOpt(t *testing.T) {
 	}
 
 }
+
+// Issue #11547
+func TestTitleCaseStyleWithAutomaticSectionPages(t *testing.T) {
+	t.Parallel()
+
+	files := `
+-- config.toml --
+titleCaseStyle = 'none'
+-- content/books/book-1.md --
+---
+title: Book 1
+tags: [fiction]
+---
+-- content/films/_index.md --
+---
+title: Films
+---
+-- layouts/index.html --
+{{ (site.GetPage "/tags").Title }}
+{{ (site.GetPage "/tags/fiction").Title }}
+{{ (site.GetPage "/books").Title }}
+{{ (site.GetPage "/films").Title }}
+	`
+
+	b := hugolib.NewIntegrationTestBuilder(
+		hugolib.IntegrationTestConfig{
+			T:           t,
+			TxtarString: files,
+		},
+	)
+	b.Build()
+	b.AssertFileContent("public/index.html", "tags\nfiction\nbooks\nFilms")
+}