hexo-theme-stellar/scripts/generators/topic.js

22 lines
491 B
JavaScript
Raw Normal View History

2024-01-14 14:10:36 +08:00
/**
* topic v1 | https://github.com/xaoxuu/hexo-theme-stellar/
*/
hexo.extend.generator.register('topic', function (locals) {
2024-01-14 17:21:19 +08:00
const { site_tree, topic } = hexo.theme.config
2024-01-14 14:10:36 +08:00
const topicIdList = Object.keys(topic.tree)
if (topicIdList.length == 0) {
return {}
}
var ret = []
ret.push({
2024-01-14 17:21:19 +08:00
path: site_tree.topic.base_dir + '/index.html',
2024-01-14 16:42:20 +08:00
layout: ['index_topic'],
2024-01-14 14:10:36 +08:00
data: {
2024-01-14 16:42:20 +08:00
layout: 'index_topic',
2024-01-14 17:21:19 +08:00
menu_id: site_tree.topic.menu_id
2024-01-14 16:42:20 +08:00
}
2024-01-14 14:10:36 +08:00
})
return ret
})