mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-21 20:46:30 -05:00
Prevent panic on empty authorlist
This commit is contained in:
parent
3392133128
commit
7d3dfba84b
1 changed files with 4 additions and 1 deletions
|
@ -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{}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue