Skip to content

Commit

Permalink
Fix handling of build options for term pages
Browse files Browse the repository at this point in the history
Fixes #12058
  • Loading branch information
bep committed Feb 18, 2024
1 parent 60b176c commit 5ada27b
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
3 changes: 3 additions & 0 deletions hugolib/content_map_page.go
Original file line number Diff line number Diff line change
Expand Up @@ -1904,6 +1904,9 @@ func (m *pageMap) CreateSiteTaxonomies(ctx context.Context) error {

switch p.Kind() {
case kinds.KindTerm:
if !p.m.shouldList(true) {
return false, nil
}
taxonomy := m.s.taxonomies[viewName.plural]
if taxonomy == nil {
return true, fmt.Errorf("missing taxonomy: %s", viewName.plural)
Expand Down
27 changes: 27 additions & 0 deletions hugolib/taxonomy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -858,3 +858,30 @@ draft: true

b.AssertFileExists("public/tags/a/index.html", false)
}

func TestTermBuildNeverRenderNorList(t *testing.T) {
t.Parallel()

files := `
-- layouts/index.html --
|{{ len site.Taxonomies.tags }}|
-- content/p1.md --
---
title: p1
tags: [a]
---
-- content/tags/a/_index.md --
---
title: tag-a-title-override
build:
render: never
list: never
---
`

b := Test(t, files)

b.AssertFileExists("public/tags/a/index.html", false)
b.AssertFileContent("public/index.html", "|0|")
}

0 comments on commit 5ada27b

Please sign in to comment.