Themes

  • 2018-12-03

hexo.theme inherits from Box, and also saves templates.

Get a View

1
hexo.theme.getView(path);

Set a View

1
hexo.theme.setView(path, data);

Remove a View

1
hexo.theme.removeView(path);

View

Views have two methods: render and renderSync. These two methods are identical, but the former is asynchronous and the latter is synchronous. So for the sake of simplicity, we will only discuss render here.

1
2
3
4
5
var view = hexo.theme.getView('layout.swig');

view.render({foo: 1, bar: 2}).then(function(result){
// ...
});

You can pass options to the render method and it will try to process the template with the corresponding renderer and load the helpers. When rendering is complete, it will try to find whether a layout exists. If layout is false or if it doesn’t exist, the result will be returned directly.

扫码领红包

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

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

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

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

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