Skip to content

Commit

Permalink
Fix: tag posts order
Browse files Browse the repository at this point in the history
  • Loading branch information
zhongdongy committed Mar 21, 2023
1 parent a16a779 commit ac18537
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/libs/renderer/renderer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,10 @@ pub fn render_index_template(
tags_count_tuples.sort_by(|a, b| b.1.cmp(&a.1));
if let Some(desc) = descriptor {
if let IndexDescriptor::Tag(tag) = desc {
let posts = tag_db.query_posts(tag.clone()).unwrap();
let mut posts = tag_db.query_posts(tag.clone()).unwrap();
posts.sort_by(|p1, p2| {
p2.preamble.created_at.cmp(&p1.preamble.created_at)
});
context.insert("posts", &posts);
context.insert("tag_name", &tag);
context.insert("link", &format!("/tag/{}/", &tag));
Expand Down

0 comments on commit ac18537

Please sign in to comment.