Hexo has a powerful plugin system, which makes it easy to extend functions without modifying the source code of the core module. There are two kinds of plugins in Hexo:
scripts folder and Hexo will load them during initialization.
If your code is complicated or if you want to publish it to the NPM registry, we recommend using a plugin. First, create a folder in the
node_modules folder. The name of this folder must begin with
hexo- or Hexo will ignore it.
package.json file that describes the purpose of the plugin and sets its dependencies.
At the very least, you should set the
main entries in
package.json. For example:
You’ll also need to list your plugin as a dependency in the root
package.json of your hexo instance in order for Hexo to detect and load it.
You can make use of the official tools provided by Hexo to accelerate development:
- hexo-fs：File IO
- hexo-i18n：Localization (i18n)
- hexo-pagination：Generate pagination data
- Fork hexojs/site
Clone the repository to your computer and install dependencies.
$ git clone https://github.com/<username>/site.git
$ cd site
$ npm install
source/_data/plugins.ymland add your plugin. For example:
- name: hexo-server
description: Server module for Hexo.
Push the branch.
- Create a pull request and describe the change.