Loading...

Loading...

Local variables are used for template rendering, which is the site variable in templates.

Default Variables

VariableDescription
postsAll posts
pagesAll pages
categoriesAll categories
tagsAll tags

Get a Variable

hexo.locals.get("posts");

Set a Variable

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

Remove a Variable

hexo.locals.remove("posts");

Get All Variable

hexo.locals.toObject();

Invalidate the cache

hexo.locals.invalidate();
Comments
Data Loading...