mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-19 21:21:39 +02:00
Prevent panic on empty authorlist
This commit is contained in:
committed by
Bjørn Erik Pedersen
parent
3392133128
commit
7d3dfba84b
@@ -193,8 +193,11 @@ func (p *Page) Author() Author {
|
|||||||
|
|
||||||
func (p *Page) Authors() AuthorList {
|
func (p *Page) Authors() AuthorList {
|
||||||
authorKeys, ok := p.Params["authors"]
|
authorKeys, ok := p.Params["authors"]
|
||||||
|
if !ok {
|
||||||
|
return AuthorList{}
|
||||||
|
}
|
||||||
authors := authorKeys.([]string)
|
authors := authorKeys.([]string)
|
||||||
if !ok || len(authors) < 1 || len(p.Site.Authors) < 1 {
|
if len(authors) < 1 || len(p.Site.Authors) < 1 {
|
||||||
return AuthorList{}
|
return AuthorList{}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user