hexo-theme-stellar/scripts/events/lib/authors.js

21 lines
536 B
JavaScript
Raw Normal View History

2024-01-04 22:50:57 +08:00
/**
* authors.js v2 | https://github.com/xaoxuu/hexo-theme-stellar/
*/
'use strict';
module.exports = ctx => {
var authors = ctx.locals.get('data').authors || {}
2024-01-14 16:42:20 +08:00
let basePath = ctx.theme.config.root.author.base_dir
2024-01-04 22:50:57 +08:00
// url
for (let key of Object.keys(authors)) {
let author = authors[key]
author.path = `${basePath}/${key}/index.html`
}
// default author
const keys = Object.keys(authors)
if (keys.length > 0) {
ctx.theme.config.default_author = authors[keys[0]]
}
ctx.theme.config.authors = authors
}