diff options
author | Bjørn Erik Pedersen <[email protected]> | 2024-02-24 16:52:41 +0100 |
---|---|---|
committer | Bjørn Erik Pedersen <[email protected]> | 2024-02-25 11:38:52 +0100 |
commit | 049dd1d7e0e106d861c60e5417c907bc3a686dcb (patch) | |
tree | f697da482fac710f0cd5c8c54ada91049e788c60 | |
parent | 189b72331e02a17e25f5102af02486d25e27e826 (diff) | |
download | hugo-049dd1d7e0e106d861c60e5417c907bc3a686dcb.tar.gz hugo-049dd1d7e0e106d861c60e5417c907bc3a686dcb.zip |
Fix panic for disableKinds page for content resources
Fixes #12144
-rw-r--r-- | hugolib/config_test.go | 19 | ||||
-rw-r--r-- | hugolib/content_map.go | 4 |
2 files changed, 23 insertions, 0 deletions
diff --git a/hugolib/config_test.go b/hugolib/config_test.go index 0d517896f..7914dda45 100644 --- a/hugolib/config_test.go +++ b/hugolib/config_test.go @@ -1539,3 +1539,22 @@ List. b.AssertLogContains("WARN DEPRECATED: Kind \"taxonomyterm\" used in disableKinds is deprecated, use \"taxonomy\" instead.\n") b.AssertLogContains("WARN DEPRECATED: Kind \"taxonomyterm\" used in outputs configuration is deprecated, use \"taxonomy\" instead.\n") } + +func TestDisableKindsIssue12144(t *testing.T) { + files := ` +-- hugo.toml -- +disableKinds = ["page"] +defaultContentLanguage = "pt-br" +-- layouts/index.html -- +Home. +-- content/custom/index.pt-br.md -- +--- +title: "P1 pt" +--- +-- content/custom/index.en-us.md -- +--- +title: "P1 us" +--- +` + Test(t, files) +} diff --git a/hugolib/content_map.go b/hugolib/content_map.go index 23b74e1c7..0b82bdf28 100644 --- a/hugolib/content_map.go +++ b/hugolib/content_map.go @@ -193,6 +193,10 @@ func (m *pageMap) AddFi(fi hugofs.FileMetaInfo) error { if err != nil { return err } + if pageResource == nil { + // Disabled page. + return nil + } key = pi.Base() rs = &resourceSource{r: pageResource} |