Skip to content

Commit

Permalink
Fix sort items on the index page
Browse files Browse the repository at this point in the history
  • Loading branch information
bake committed Jun 10, 2019
1 parent e9c03dc commit ff96c03
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,14 @@ func main() {
if len(items) > *maxItems {
items = items[:*maxItems]
}
sort.Sort(sort.Reverse(sortByPublished(items)))
allItems = append(allItems, items...)
if err := render(cat, catNames, items, tmpl, *outPath); err != nil {
log.Printf("could not render %s: %v", cat, err)
}
}

sort.Sort(sort.Reverse(sortByPublished(allItems)))
if len(allItems) > *maxItems {
allItems = allItems[:*maxItems]
}
Expand All @@ -92,7 +94,6 @@ func main() {
}

func render(category string, categories []string, items []item, tmpl *template.Template, outPath string) error {
sort.Sort(sort.Reverse(sortByPublished(items)))
data := struct {
Category string
Categories []string
Expand Down

0 comments on commit ff96c03

Please sign in to comment.