'use strict';
/* global hexo */
hexo.extend.helper.register('guide_toc', function() {
const toc = this.site.data.guide_toc;
let menu = '
';
for (const title in toc) {
const subMenu = toc[title];
menu += `- ${this.__('guide_toc.' + title)}
';
}
menu += '
';
return menu;
});
hexo.extend.helper.register('menu_link', function() {
const menus = this.site.data.menu;
let links = '';
for (const menu in menus) {
let link = menus[menu];
const content = this.__(`menu.${menu}`);
if (menu === 'guide' && this.page.lang !== 'en') {
link = '/' + this.page.lang + link;
}
links += `${content}`;
}
return links;
});
hexo.extend.helper.register('index_link', function() {
if (this.page.lang !== 'en') {
return `/${this.page.lang}/`;
}
return '/';
});