mirror of
https://github.com/gohugoio/hugo.git
synced 2025-03-22 13:33:50 +00:00
parent
acbedf6220
commit
75deb923d9
1 changed files with 12 additions and 12 deletions
|
@ -671,26 +671,26 @@ func (p *Page) getParam(key string, stringToLower bool) interface{} {
|
||||||
|
|
||||||
switch v.(type) {
|
switch v.(type) {
|
||||||
case bool:
|
case bool:
|
||||||
return cast.ToBool(v)
|
return v
|
||||||
case string:
|
case time.Time:
|
||||||
if stringToLower {
|
return v
|
||||||
return strings.ToLower(cast.ToString(v))
|
|
||||||
}
|
|
||||||
return cast.ToString(v)
|
|
||||||
case int64, int32, int16, int8, int:
|
case int64, int32, int16, int8, int:
|
||||||
return cast.ToInt(v)
|
return cast.ToInt(v)
|
||||||
case float64, float32:
|
case float64, float32:
|
||||||
return cast.ToFloat64(v)
|
return cast.ToFloat64(v)
|
||||||
case time.Time:
|
case map[string]interface{}: // JSON and TOML
|
||||||
return cast.ToTime(v)
|
return v
|
||||||
|
case map[interface{}]interface{}: // YAML
|
||||||
|
return v
|
||||||
|
case string:
|
||||||
|
if stringToLower {
|
||||||
|
return strings.ToLower(v.(string))
|
||||||
|
}
|
||||||
|
return v
|
||||||
case []string:
|
case []string:
|
||||||
if stringToLower {
|
if stringToLower {
|
||||||
return helpers.SliceToLower(v.([]string))
|
return helpers.SliceToLower(v.([]string))
|
||||||
}
|
}
|
||||||
return v.([]string)
|
|
||||||
case map[string]interface{}: // JSON and TOML
|
|
||||||
return v
|
|
||||||
case map[interface{}]interface{}: // YAML
|
|
||||||
return v
|
return v
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue