2020-03-17 17:58:18 +08:00
|
|
|
|
/**
|
|
|
|
|
* Hexo 扩展:辅助函数(Helper)
|
|
|
|
|
* 补充复杂的业务逻辑
|
|
|
|
|
* https://hexo.io/zh-cn/api/helper.html
|
2020-03-25 12:27:44 +08:00
|
|
|
|
* eg 用法:<%= helper_test('xxx') %>
|
2020-03-17 17:58:18 +08:00
|
|
|
|
*/
|
|
|
|
|
hexo.extend.helper.register('helper_test', function (character) {
|
|
|
|
|
return character + '😁';
|
2020-03-25 12:27:44 +08:00
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
hexo.extend.helper.register('isInHomePaging', function (pagePath, route) {
|
|
|
|
|
if (pagePath.length > 5 && route === '/' ) {
|
|
|
|
|
return pagePath.slice(0, 5) === 'page/';
|
|
|
|
|
} else {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
2020-03-17 17:58:18 +08:00
|
|
|
|
});
|