From 4bfe9e2c574c9e2cae11d5ab712fab0f9e90f896 Mon Sep 17 00:00:00 2001 From: xaoxuu Date: Mon, 22 Jan 2024 15:56:40 +0800 Subject: [PATCH] =?UTF-8?q?[fix]=20author=E2=80=99s=20page=20#367?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- layout/archive.ejs | 2 +- scripts/generators/author.js | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/layout/archive.ejs b/layout/archive.ejs index c42af30..a4120bf 100755 --- a/layout/archive.ejs +++ b/layout/archive.ejs @@ -17,7 +17,7 @@ function layoutArchiveList() { } el += `
` var years = [] - const posts = page.author != null ? site.posts.filter(p => (p.author || theme.default_author.name) == page.author.name) : site.posts + const posts = page.author != null ? site.posts.filter(p => (p.author || theme.default_author.id) == page.author.id) : site.posts posts.sort('date', -1).each(function(post) { post.year = date(post.date, 'YYYY') if (post.year && (years.includes(post.year) == false) && (post.title || post.date)) { diff --git a/scripts/generators/author.js b/scripts/generators/author.js index b3fc7fd..0143850 100644 --- a/scripts/generators/author.js +++ b/scripts/generators/author.js @@ -6,10 +6,11 @@ hexo.extend.generator.register('author', function (locals) { const { site_tree, authors } = hexo.theme.config var pages = [] for (let key of Object.keys(authors)) { - const author = authors[key] + var author = authors[key] if (author.hidden) { continue } + author.id = key pages.push({ path: author.path, layout: ['archive'],