區域變數

區域變數用於模版渲染,也就是模版中的 site 變數。

預設變數

變數描述
posts所有文章
pages所有分頁
categories所有分類
tags所有標籤

取得變數

hexo.locals.get('posts')

設定變數

hexo.locals.set('posts', function(){
return ...
});

移除變數

hexo.locals.remove('posts');

取得所有變數

hexo.locals.toObject();

清除快取

hexo.locals.invalidate();