mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-28 22:19:59 +02:00
Fix Params case handling in the index, sort and where func
This means that you can now do: ``` {{ range where .Site.Pages "Params.MYPARAM" "foo" }} ```
This commit is contained in:
@@ -19,12 +19,16 @@ import (
|
||||
"github.com/spf13/cast"
|
||||
)
|
||||
|
||||
func Param(r ResourceParamsProvider, fallback map[string]interface{}, key interface{}) (interface{}, error) {
|
||||
func Param(r ResourceParamsProvider, fallback maps.Params, key interface{}) (interface{}, error) {
|
||||
keyStr, err := cast.ToStringE(key)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if fallback == nil {
|
||||
return maps.GetNestedParam(keyStr, ".", r.Params())
|
||||
}
|
||||
|
||||
return maps.GetNestedParam(keyStr, ".", r.Params(), fallback)
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user