Skip to content

Commit

Permalink
Fix panic for disableKinds page for content resources
Browse files Browse the repository at this point in the history
Fixes #12144
  • Loading branch information
bep committed Feb 25, 2024
1 parent 189b723 commit 049dd1d
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
19 changes: 19 additions & 0 deletions hugolib/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
4 changes: 4 additions & 0 deletions hugolib/content_map.go
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down

0 comments on commit 049dd1d

Please sign in to comment.