mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-30 22:39:58 +02:00
Fix Params case handling in where with slices of structs (e.g. Pages)
Fixes #7009
This commit is contained in:
@@ -382,12 +382,21 @@ func (ns *Namespace) checkWhereArray(seqv, kv, mv reflect.Value, path []string,
|
||||
vvv = reflect.ValueOf(params.Get(path...))
|
||||
} else {
|
||||
vvv = rvv
|
||||
for _, elemName := range path {
|
||||
for i, elemName := range path {
|
||||
var err error
|
||||
vvv, err = evaluateSubElem(vvv, elemName)
|
||||
|
||||
if err != nil {
|
||||
continue
|
||||
}
|
||||
|
||||
if i < len(path)-1 && vvv.IsValid() {
|
||||
if params, ok := vvv.Interface().(maps.Params); ok {
|
||||
// The current path element is the map itself, .Params.
|
||||
vvv = reflect.ValueOf(params.Get(path[i+1:]...))
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user