Skip to content

Latest commit

 

History

History
44 lines (32 loc) · 586 Bytes

locals.md

File metadata and controls

44 lines (32 loc) · 586 Bytes

title: 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();