diff --git a/main.go b/main.go index 9473b4c..7a90ee1 100644 --- a/main.go +++ b/main.go @@ -11,6 +11,7 @@ import ( "net/http" "os" "path" + "slices" "strconv" "time" @@ -387,6 +388,14 @@ func main() { episode.CreatedAt = episode.CreatedAt.In(loc) } + slices.SortFunc(episodes, func(a, b *Episode) int { + if a.CreatedAt.Before(b.CreatedAt) { + return 1 + } else { + return -1 + } + }) + tmpl.ExecuteTemplate(w, "podcast.html", struct { Podcast *Podcast Episodes []*Episode