Skip to content

Commit

Permalink
Allow legacy taxonomyTerm in disableKinds
Browse files Browse the repository at this point in the history
Updates #10953
  • Loading branch information
bep committed May 19, 2023
1 parent ad4bc96 commit 03cb38e
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 1 deletion.
7 changes: 6 additions & 1 deletion config/allconfig/allconfig.go
Expand Up @@ -222,7 +222,12 @@ func (c *Config) CompileConfig() error {
}
disabledKinds := make(map[string]bool)
for _, kind := range c.DisableKinds {
disabledKinds[strings.ToLower(kind)] = true
kind = strings.ToLower(kind)
if kind == "taxonomyterm" {
// Legacy config.
kind = "term"
}
disabledKinds[kind] = true
}
kindOutputFormats := make(map[string]output.Formats)
isRssDisabled := disabledKinds["rss"]
Expand Down
29 changes: 29 additions & 0 deletions hugolib/config_test.go
Expand Up @@ -897,3 +897,32 @@ mainSections: []
`)

}

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

files := `
-- hugo.toml --
# taxonomyTerm was renamed to term in Hugo 0.60.0.
disableKinds = ["taxonomyTerm"]
-- layouts/index.html --
Home
`

b, err := NewIntegrationTestBuilder(
IntegrationTestConfig{
T: t,
TxtarString: files,
},
).BuildE()

b.Assert(err, qt.IsNil)
b.AssertFileContent("public/index.html", `
Home
`)

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

0 comments on commit 03cb38e

Please sign in to comment.