Helper

  • 2018-12-03

A helper makes it easy to quickly add snippets to your templates. We recommend using helpers instead of templates when you’re dealing with more complicated code.

Helpers can not be accessed from source files.

Synopsis

1
2
3
hexo.extend.helper.register(name, function(){
// ...
});

Example

1
2
3
hexo.extend.helper.register('js', function(path){
return '<script type="text/javascript" src="' + path + '"></script>';
});
1
2
<%- js('script.js') %>
// <script type="text/javascript" src="script.js"></script>

扫码领红包

2018双11超级红包
PC访问链接: 2018双11超级红包 预售开启 汇聚全球潮流新品

淘口令:¥20Y0b6q4eHR¥ (复制此行再打开手机淘宝客访问)

最后更新: 2018年12月03日 09:29

原始链接: https://cyc.oy99.com/api/helper.html

× 多少都行~
打赏二维码
×
  • {title}