Sort posts by date
This commit is contained in:
parent
56ee5cf478
commit
9f39baa563
@ -21,6 +21,8 @@ final class PostListPageGenerator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func createPages(for posts: [Post]) {
|
func createPages(for posts: [Post]) {
|
||||||
|
// Sort by newest first
|
||||||
|
let posts = posts.sorted(ascending: false) { $0.startDate }
|
||||||
let totalCount = posts.count
|
let totalCount = posts.count
|
||||||
guard totalCount > 0 else {
|
guard totalCount > 0 else {
|
||||||
// Create one empty page
|
// Create one empty page
|
||||||
|
Loading…
x
Reference in New Issue
Block a user