From 7e2fa31b622c457f027029078d590920bdf14753 Mon Sep 17 00:00:00 2001 From: xaoxuu Date: Sat, 19 Nov 2022 23:14:41 +0800 Subject: [PATCH] [fix] recent sort --- layout/_partial/sidebar/widgets/recent.ejs | 3 ++- scripts/events/lib/doc_tree.js | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/layout/_partial/sidebar/widgets/recent.ejs b/layout/_partial/sidebar/widgets/recent.ejs index 208dcbd..37d366e 100644 --- a/layout/_partial/sidebar/widgets/recent.ejs +++ b/layout/_partial/sidebar/widgets/recent.ejs @@ -20,11 +20,12 @@ function layoutDiv() { } return false }) + arr = arr.sort((p1, p2) => p1.updated > p2.updated ? -1 : 1) } else { arr = site.posts.filter( p => p.title && p.title.length > 0) + arr = arr.sort("updated", -1) } el += '