From ff96c030d71fa24c3b57ea5467907c9246f48119 Mon Sep 17 00:00:00 2001 From: bake Date: Mon, 10 Jun 2019 11:36:48 +0200 Subject: [PATCH] Fix sort items on the index page --- main.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/main.go b/main.go index 06b72eb..05b111b 100644 --- a/main.go +++ b/main.go @@ -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] } @@ -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