]> git.maquefel.me Git - brevno-suite/hugo/commitdiff
Fix broken handling of legacy taxonomyTerm in disableKinds
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Wed, 19 Jul 2023 17:10:34 +0000 (19:10 +0200)
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Wed, 19 Jul 2023 17:59:17 +0000 (19:59 +0200)
Fixes #11257

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

index 9960c28f372d1ee07e4c32ad091a07d64bf4da03..72f2883f258db9120102fbcd5117d3be49f0f7dd 100644 (file)
@@ -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
        }
index 9720522ad0e658dedb8d91d000b9da4a30261b13..ff7b01a3fa73146e45d6acddff7b517c61769a70 100644 (file)
@@ -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 --
@@ -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
@@ -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)
+
+}