add theme

This commit is contained in:
2025-08-12 12:19:25 +08:00
parent 8c06923a46
commit ac0d1944ab
227 changed files with 18962 additions and 0 deletions

View File

@@ -0,0 +1,22 @@
'use strict'
hexo.extend.helper.register('groupPosts', function () {
const getGroupArray = array => {
return array.reduce((groups, item) => {
const key = item.series
if (key) {
groups[key] = groups[key] || []
groups[key].push(item)
}
return groups
}, {})
}
const sortPosts = posts => {
const { orderBy = 'date', order = 1 } = this.theme.aside.card_post_series
if (orderBy === 'title') return posts.sort('title', order)
return posts.sort('date', order)
}
return getGroupArray(sortPosts(this.site.posts))
})