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.ymlorthemes/[theme_name]/_config.page.yml, - post/page layout config defined in
[site_root]/_config.post.ymlor[site_root]/_config.page.yml, - theme config defined in
themes/[theme_name]/_config.ymlornode_modules/hexo-theme-[theme_name]/_config.ymlif 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. |