]> git.maquefel.me Git - brevno-suite/hugo/commitdiff
Allow legacy taxonomyTerm in disableKinds
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Fri, 19 May 2023 07:17:55 +0000 (09:17 +0200)
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Fri, 19 May 2023 07:17:55 +0000 (09:17 +0200)
Updates #10953

config/allconfig/allconfig.go
hugolib/config_test.go

index 1048dda82d1794885a4f471b6dbada768c03f2bf..22e9f1deb4011929b0ac302672845ccfa0a4ce92 100644 (file)
@@ -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"]
index 994734ce6e336ff904b8654a5760f3f28d4332f4..1d4372e41f57b331581d9f7e08dcf89a0e562586 100644 (file)
@@ -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)
+}