Local Variables

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

Default Variables

Variable Description
posts All posts
pages All pages
categories All categories
tags All 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();