From 03cb38e6c6d60e95df1f40a56fe432e1747ea7ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Fri, 19 May 2023 09:17:55 +0200 Subject: [PATCH] Allow legacy taxonomyTerm in disableKinds Updates #10953 --- config/allconfig/allconfig.go | 7 ++++++- hugolib/config_test.go | 29 +++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/config/allconfig/allconfig.go b/config/allconfig/allconfig.go index 1048dda82..22e9f1deb 100644 --- a/config/allconfig/allconfig.go +++ b/config/allconfig/allconfig.go @@ -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"] diff --git a/hugolib/config_test.go b/hugolib/config_test.go index 994734ce6..1d4372e41 100644 --- a/hugolib/config_test.go +++ b/hugolib/config_test.go @@ -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) +}