From dcff1e32a3c179202b910dd75319e005a15a8118 Mon Sep 17 00:00:00 2001 From: xaoxuu Date: Mon, 22 Jan 2024 12:19:10 +0800 Subject: [PATCH] =?UTF-8?q?[feat]=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 | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/layout/archive.ejs b/layout/archive.ejs index ea56ac8..c42af30 100755 --- a/layout/archive.ejs +++ b/layout/archive.ejs @@ -17,7 +17,8 @@ function layoutArchiveList() { } el += `
` var years = [] - site.posts.sort('date', -1).each(function(post) { + const posts = page.author != null ? site.posts.filter(p => (p.author || theme.default_author.name) == page.author.name) : 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)) { years.push(post.year) @@ -26,7 +27,7 @@ function layoutArchiveList() { for (let year of years) { el += `
` el += `
${year}
` - site.posts.sort('date', -1).filter(function (post) { + posts.sort('date', -1).filter(function (post) { post.year = date(post.date, 'YYYY') return post.year == year }).each(function(post) {