From a381f3b41918ced0604951d67504a0534510a9e2 Mon Sep 17 00:00:00 2001 From: XPoet Date: Mon, 30 Mar 2020 11:07:57 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20archive=20=E5=BD=92=E6=A1=A3=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E6=8E=92=E5=BA=8F=E9=94=99=E4=B9=B1=E7=9A=84=20bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- _config.yml | 2 ++ scripts/helpers/helper.js | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/_config.yml b/_config.yml index 5571848..a8c62e6 100644 --- a/_config.yml +++ b/_config.yml @@ -20,6 +20,7 @@ page: right_side_width: 70 media_max_width: 960 + # Social Links. # Usage: `Key: permalink || icon` # Key is the link label showing to end users. @@ -43,6 +44,7 @@ social: # https://github.com/chriskempson/tomorrow-theme highlight_theme: normal + # Valine. # You can get your appid and appkey from https://leancloud.cn # more info please open https://github.com/xCss/Valine diff --git a/scripts/helpers/helper.js b/scripts/helpers/helper.js index 5e23245..6cc5835 100644 --- a/scripts/helpers/helper.js +++ b/scripts/helpers/helper.js @@ -9,12 +9,13 @@ hexo.extend.helper.register('isInHomePaging', function (pagePath, route) { hexo.extend.helper.register('createNewArchivePosts', function (posts) { const postList = [], postYearList = []; posts.forEach(post => postYearList.push(post.date.year())); - Array.from(new Set(postYearList)).reverse().forEach(year => { + Array.from(new Set(postYearList)).forEach(year => { postList.push({ year: year, postList: [] }) }); + postList.sort((a, b) => b.year - a.year); postList.forEach(item => { posts.forEach(post => item.year === post.date.year() && item.postList.push(post)) });