blob: c03c90ae40fb6c2ec8b59b22413bff9513bebd31 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
package main
import (
"sort"
"strings"
)
type navItem struct {
AbsoluteUrl string
Text string
}
func createNavSlice(site *siteData, cfg config) {
for k, v := range site.pages {
if k != "" {
newNavItem := navItem{AbsoluteUrl: site.baseUrl + "/" + k, Text: v.pageName}
site.nav = append(site.nav, newNavItem)
}
}
sort.Slice(site.nav, func(i, j int) bool {
return strings.Compare(site.nav[i].Text, site.nav[j].Text) < 0
})
}
|