Add solitude

This commit is contained in:
IF-chan
2024-07-05 21:01:19 +08:00
parent 26d71c4fbc
commit 71758b9fce
289 changed files with 23277 additions and 0 deletions
@@ -0,0 +1,14 @@
const moment = require('moment')
hexo.extend.helper.register('getArchiveLength', function (type) {
if (type !== 'year' && type !== 'month') {
type = 'year';
}
const posts = this.site.posts.sort('-date').data
let archive = {}
for (const post of posts) {
const postdate = type === 'year' ? moment(post.date).format('YYYY') : moment(post.date).format('YYYY/MM');
archive[postdate] = (archive[postdate] || 0) + 1;
}
return archive;
});