summaryrefslogtreecommitdiffstats
path: root/hugolib/page.go
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2019-04-15 09:38:14 +0200
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2019-04-15 13:36:05 +0200
commitb799b12f4a693dfeae8a5a362f131081a727bb8f (patch)
treecec0b90c41aea0f091ac5aa8dc72fc7380f78253 /hugolib/page.go
parent701486728e21bc0c6c78c2a8edb988abdf6116c7 (diff)
hugolib: Fix panic for unused taxonomy content files
In Hugo 0.55 we connected the taxonomy nodes with their owning Page. This failed if you had, say, a content file for a author that did not author anything in the site: ``` content/authors/silent-persin/_index.md ``` Fixes #5847
Diffstat (limited to 'hugolib/page.go')
-rw-r--r--hugolib/page.go6
1 files changed, 4 insertions, 2 deletions
diff --git a/hugolib/page.go b/hugolib/page.go
index 2ed828df6..ec4b23d90 100644
--- a/hugolib/page.go
+++ b/hugolib/page.go
@@ -746,8 +746,10 @@ func (p *pageState) getTaxonomyNodeInfo() *taxonomyNodeInfo {
info := p.s.taxonomyNodes.Get(p.SectionsEntries()...)
if info == nil {
- // This should never happpen
- panic(fmt.Sprintf("invalid taxonomy state for %q with sections %v", p.pathOrTitle(), p.SectionsEntries()))
+ // There can be unused content pages for taxonomies (e.g. author that
+ // has not written anything, yet), and these will not have a taxonomy
+ // node created in the assemble taxonomies step.
+ return nil
}
return info