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

22 lines
436 B
JavaScript
Raw Normal View History

2021-02-19 23:33:19 +08:00
/**
* wiki v1 | https://github.com/xaoxuu/hexo-theme-stellar/
*/
hexo.extend.generator.register('wiki', function (locals) {
2021-02-22 14:12:34 +08:00
var hasWiki = false;
locals.pages.forEach((page, i) => {
if (page.layout == 'wiki') {
hasWiki = true;
}
});
if (hasWiki) {
return {
path: (hexo.config.wiki_dir || 'wiki') + '/index.html',
data: locals.posts,
layout: ['wiki']
}
} else {
return {};
2021-02-19 23:33:19 +08:00
}
2021-02-22 14:12:34 +08:00
});