NexT

Theme for Hexo

0%

Injects

We extended the Hexo filter and added theme_inject, so user can add the desired custom content to any injection point.

Synopsis

A injects argument will get passed into the function, so we can use it add custom code in injectPoint as following.

For inject view:

You have to note filePath, it must be absolute path or relative to hexo_dir.

For inject style:

These are many injectPoint, defined in utils.js

custom_file_path also uses this API, see default-injects.js. It will consume custom name in view inject points. So if you use custom_file_path, please not use custom.

Examples

One: load a custom script. We can add it in bodyEnd.

Two: add a custom my-favourite-food.njk to sidebar.

Step1: you should create my-favourite-food.njk in any path(e.g. source/_data/) as below. You can get variable from hexo or local defined in filter.

Three: want to have big header, put big-header.styl to NexT.
Of course, you need to create this file first(e.g. source/_data/big-header.styl).