Skip to content

Commit

Permalink
[fix] author’s page #367
Browse files Browse the repository at this point in the history
  • Loading branch information
xaoxuu committed Jan 22, 2024
1 parent 7b6b0d2 commit 4bfe9e2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion layout/archive.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ function layoutArchiveList() {
}
el += `<div class="post-list archives">`
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)) {
Expand Down
3 changes: 2 additions & 1 deletion scripts/generators/author.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'],
Expand Down

0 comments on commit 4bfe9e2

Please sign in to comment.