Skip to content

Commit 0d0a11e

Browse files
committed
fix ordering of posts
1 parent 9f57e23 commit 0d0a11e

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/main.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,10 @@ impl Blog {
112112

113113
// finally, sort the posts. oldest first.
114114

115-
// we're gonna cheat:
115+
posts.sort_by_key(|post|
116+
format!("{}-{}-{}", post.year, post.month, post.day)
117+
);
118+
116119
posts.reverse();
117120

118121
Ok(posts)

0 commit comments

Comments
 (0)