mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-19 21:21:39 +02:00
Add support for sort by boolean
This commit is contained in:
@@ -252,6 +252,11 @@ func (ns *Namespace) compareGet(a interface{}, b interface{}) (float64, float64)
|
||||
case timeType:
|
||||
left = float64(toTimeUnix(av))
|
||||
}
|
||||
case reflect.Bool:
|
||||
left = 0
|
||||
if av.Bool() {
|
||||
left = 1
|
||||
}
|
||||
}
|
||||
|
||||
bv := reflect.ValueOf(b)
|
||||
@@ -275,6 +280,11 @@ func (ns *Namespace) compareGet(a interface{}, b interface{}) (float64, float64)
|
||||
case timeType:
|
||||
right = float64(toTimeUnix(bv))
|
||||
}
|
||||
case reflect.Bool:
|
||||
right = 0
|
||||
if bv.Bool() {
|
||||
right = 1
|
||||
}
|
||||
}
|
||||
|
||||
if ns.caseInsensitive && leftStr != nil && rightStr != nil {
|
||||
|
Reference in New Issue
Block a user