mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-19 21:21:39 +02:00
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
This commit is contained in:
@@ -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
|
||||
|
Reference in New Issue
Block a user