natural sort (#474)

This commit is contained in:
Dawid 'DeyV' Polak
2018-07-29 13:22:11 +02:00
committed by 1138-4EB
parent c6f60d298a
commit 202c9c97e5
3 changed files with 12 additions and 1 deletions

View File

@@ -20,6 +20,7 @@ import (
"time"
"github.com/gohugoio/hugo/parser"
"github.com/maruel/natural"
)
// File contains the information about a particular file or directory.
@@ -372,7 +373,7 @@ func (l byName) Less(i, j int) bool {
return false
}
return strings.ToLower(l.Items[i].Name) < strings.ToLower(l.Items[j].Name)
return natural.Less(l.Items[i].Name, l.Items[j].Name)
}
// By Size