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

22 lines
509 B
JavaScript
Raw Normal View History

2024-01-14 14:10:36 +08:00
/**
* topic v1 | https://github.com/xaoxuu/hexo-theme-stellar/
*/
2024-01-18 22:11:58 +08:00
hexo.extend.generator.register('index_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-20 01:51:09 +08:00
path: site_tree.index_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-20 01:51:09 +08:00
menu_id: site_tree.index_topic.menu_id
2024-01-14 16:42:20 +08:00
}
2024-01-14 14:10:36 +08:00
})
return ret
})