mirror of
https://github.com/gohugoio/hugo.git
synced 2024-05-11 05:54:58 +00:00
Print error if index value in a page is wrong type
This was causing a panic with no information displayed about the page causing the error.
This commit is contained in:
@ -362,8 +362,13 @@ func (s *Site) BuildSiteMeta() (err error) {
|
||||
vals := p.GetParam(plural)
|
||||
|
||||
if vals != nil {
|
||||
for _, idx := range vals.([]string) {
|
||||
s.Indexes[plural].Add(idx, s.Pages[i])
|
||||
v, ok := vals.([]string)
|
||||
if ok {
|
||||
for _, idx := range v {
|
||||
s.Indexes[plural].Add(idx, s.Pages[i])
|
||||
}
|
||||
} else {
|
||||
PrintErr("Invalid " + plural + " in " + p.File.FileName)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user