Skip to content

Commit

Permalink
Fix broken handling of legacy taxonomyTerm in disableKinds
Browse files Browse the repository at this point in the history
Fixes #11257
  • Loading branch information
bep committed Jul 19, 2023
1 parent d947db3 commit d70b6c7
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 3 deletions.
2 changes: 1 addition & 1 deletion config/allconfig/allconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ func (c *Config) CompileConfig(logger loggers.Logger) error {
kind = strings.ToLower(kind)
if kind == "taxonomyterm" {
// Legacy config.
kind = "term"
kind = "taxonomy"
}
disabledKinds[kind] = true
}
Expand Down
40 changes: 38 additions & 2 deletions hugolib/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1060,7 +1060,7 @@ func TestConfigLegacyValues(t *testing.T) {

files := `
-- hugo.toml --
# taxonomyTerm was renamed to term in Hugo 0.60.0.
# taxonomyTerm was renamed to taxonomy in Hugo 0.60.0.
disableKinds = ["taxonomyTerm"]
-- layouts/index.html --
Expand All @@ -1081,7 +1081,7 @@ Home
`)

conf := b.H.Configs.Base
b.Assert(conf.IsKindEnabled("term"), qt.Equals, false)
b.Assert(conf.IsKindEnabled("taxonomy"), qt.Equals, false)
}

// Issue #11000
Expand Down Expand Up @@ -1534,3 +1534,39 @@ disableKinds = ["taxonomy", "term", "RSS", "sitemap", "robotsTXT", "page", "sect
})

}

// Issue #11257
func TestDisableKindsTaxonomyTerm(t *testing.T) {
t.Parallel()

files := `
-- hugo.toml --
baseURL = "https://example.com"
disableKinds = ['taxonomyTerm']
[taxonomies]
category = 'categories'
-- content/p1.md --
---
title: "P1"
categories: ["c1"]
---
-- layouts/index.html --
Home.
-- layouts/_default/list.html --
List.
`
b := NewIntegrationTestBuilder(
IntegrationTestConfig{
T: t,
TxtarString: files,
},
).Build()

b.AssertDestinationExists("index.html", true)
b.AssertDestinationExists("categories/c1/index.html", true)
b.AssertDestinationExists("categories/index.html", false)

}

0 comments on commit d70b6c7

Please sign in to comment.