Register the Hexo filter for merging theme and site config, and add all helper functions to a
dedicated property (
helper
) in the locals.- Source:
(require("hexo/filter/locals"))(hexo)
Register the Hexo filter for merging theme and site config, and add all helper functions to a
dedicated property (
It also adds a new variable named
helper
) in the locals.
This filter will try to merge
- the post/page config defined in the Markdown file's front-matter,
- post/page config defined in
themes/[theme_name]/_config.post.yml
orthemes/[theme_name]/_config.page.yml
, - post/page layout config defined in
[site_root]/_config.post.yml
or[site_root]/_config.page.yml
, - theme config defined in
themes/[theme_name]/_config.yml
ornode_modules/hexo-theme-[theme_name]/_config.yml
if it is installed as an NPM package, - and the site config defined in
_config.yml
,
It also adds a new variable named
helper
, containing all Hexo helper functions, to the page
locals so that you can them through it instead.
It is useful for passing helper functions to the cacheable view components.
NOTE: This filter must be registered before any other Hexo extensions or views in order to take effect.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
hexo |
Hexo
|
The Hexo instance. |