Skip to content

Commit b65bdc5

Browse files
Merge pull request #501 from bobrik/ivan/sort-dates-like-the-mother-nature-intended-in-iso8601
Sort posts as YYYY-MM-DD-TITLE, not YYYY-M-D-TITLE
2 parents 29b16a2 + adbd7eb commit b65bdc5

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/blogs.rs

+6-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,12 @@ impl Blog {
5959
}
6060
}
6161

62-
posts.sort_by_key(|post| post.url.clone());
62+
posts.sort_by_key(|post| {
63+
format!(
64+
"{}-{:02}-{:02}-{}",
65+
post.year, post.month, post.day, post.title
66+
)
67+
});
6368
posts.reverse();
6469

6570
// Decide which posts should show the year in the index.

0 commit comments

Comments
 (0)