2021-02-19 23:33:19 +08:00
|
|
|
/**
|
|
|
|
* wiki v1 | https://github.com/xaoxuu/hexo-theme-stellar/
|
|
|
|
*/
|
|
|
|
|
|
|
|
hexo.extend.generator.register('wiki', function (locals) {
|
2024-01-14 16:42:20 +08:00
|
|
|
const { root, wiki } = hexo.theme.config
|
|
|
|
const wikiIdList = Object.keys(wiki.tree)
|
|
|
|
if (wikiIdList.length == 0) {
|
|
|
|
return {}
|
|
|
|
}
|
|
|
|
var ret = []
|
|
|
|
ret.push({
|
|
|
|
path: root.wiki.base_dir + '/index.html',
|
|
|
|
layout: ['index_wiki'],
|
|
|
|
data: {
|
|
|
|
layout: 'index_wiki',
|
|
|
|
menu_id: root.wiki.menu_id,
|
|
|
|
filter: false
|
2021-02-22 14:12:34 +08:00
|
|
|
}
|
2024-01-14 16:42:20 +08:00
|
|
|
})
|
|
|
|
if (wiki.all_tags) {
|
|
|
|
for (let id of Object.keys(wiki.all_tags)) {
|
|
|
|
let tag = wiki.all_tags[id]
|
|
|
|
ret.push({
|
|
|
|
path: tag.path,
|
|
|
|
layout: ['index_wiki'],
|
|
|
|
data: {
|
|
|
|
layout: 'index_wiki',
|
|
|
|
menu_id: root.wiki.menu_id,
|
|
|
|
filter: true,
|
|
|
|
tagName: tag.name
|
|
|
|
}
|
|
|
|
})
|
2021-02-22 14:12:34 +08:00
|
|
|
}
|
2021-02-19 23:33:19 +08:00
|
|
|
}
|
2024-01-14 16:42:20 +08:00
|
|
|
return ret
|
|
|
|
})
|