diff --git a/src/contexts/posts.rs b/src/contexts/posts.rs index e734427..8816b2d 100644 --- a/src/contexts/posts.rs +++ b/src/contexts/posts.rs @@ -28,7 +28,7 @@ fn get_posts_data() -> Vec { options.compile.allow_dangerous_html = true; options.parse.constructs.frontmatter = true; - let posts = FILES + let mut posts: Vec = FILES .iter() .map(|file| { let matter = Matter::::new(); @@ -46,5 +46,8 @@ fn get_posts_data() -> Vec { }) .collect(); + posts.sort_by_key(|p| p.metadata.date); + posts.reverse(); + posts }