mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-18 21:11:19 +02:00
fix tags not being in lowercase, #491
This commit is contained in:
@@ -431,7 +431,7 @@ func (page *Page) GetParam(key string) interface{} {
|
||||
case bool:
|
||||
return cast.ToBool(v)
|
||||
case string:
|
||||
return cast.ToString(v)
|
||||
return strings.ToLower(cast.ToString(v))
|
||||
case int64, int32, int16, int8, int:
|
||||
return cast.ToInt(v)
|
||||
case float64, float32:
|
||||
@@ -439,7 +439,7 @@ func (page *Page) GetParam(key string) interface{} {
|
||||
case time.Time:
|
||||
return cast.ToTime(v)
|
||||
case []string:
|
||||
return v
|
||||
return sliceToLower(v.([]string))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -795,3 +795,17 @@ func (p *Page) TargetPath() (outfile string) {
|
||||
|
||||
return path.Join(p.Dir, strings.TrimSpace(outfile))
|
||||
}
|
||||
|
||||
// sliceToLower goes through the source slice and lowers all values.
|
||||
func sliceToLower(s []string) []string {
|
||||
if s == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
l := make([]string, len(s))
|
||||
for i, v := range s {
|
||||
l[i] = strings.ToLower(v)
|
||||
}
|
||||
|
||||
return l
|
||||
}
|
||||
|
Reference in New Issue
Block a user