Sort posts by date

This commit is contained in:
Christoph Hagen 2025-01-07 10:32:20 +01:00
parent 56ee5cf478
commit 9f39baa563

View File

@ -21,6 +21,8 @@ final class PostListPageGenerator {
}
func createPages(for posts: [Post]) {
// Sort by newest first
let posts = posts.sorted(ascending: false) { $0.startDate }
let totalCount = posts.count
guard totalCount > 0 else {
// Create one empty page