Sort blog posts by publication date
This commit is contained in:
@@ -40,7 +40,10 @@ func getAllPosts() []Post {
|
|||||||
posts = append(posts, makePost(post))
|
posts = append(posts, makePost(post))
|
||||||
}
|
}
|
||||||
|
|
||||||
//fmt.Println(posts[0].UpdatedDate.IsZero())
|
sort.Slice(posts, func(i, j int) bool {
|
||||||
|
return posts[i].Date.After(posts[j].Date)
|
||||||
|
})
|
||||||
|
|
||||||
return posts
|
return posts
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user