Hexo has a powerful plugin system, which makes you easy to extend functions without modifying source code of the core module. There’re two kinds of plugins in Hexo:


If your code is simple, it’s recommended to use a script. All you need to do is putting JavaScript files in scripts folder and they’ll be loaded once Hexo is initialized.


If your code is complicated or you want to publish it to NPM registry, it’s recommended to use a plugin. First, create a folder in node_modules folder. The name of the folder must be started with hexo- so it could be loaded by Hexo.

The folder must be contained at least 2 files: One is the main program and the other is package.json describing the purpose and the dependencies of the plugin.

├── index.js
└── package.json

You should at least describe name, version, main in package.json. For example:

"name": "hexo-my-plugin",
"version": "0.0.1",
"main": "index"


You can make use of the official tools provided by Hexo to accelerate development:


Once your plugin has been done, you can consider to publish it to plugin list to make more people use your plugin. The steps to publish a plugin is very simliar to updating documentation.

  1. Fork hexojs/site
  2. Clone the repository to your computer and install dependencies.

    $ git clone<username>/site.git
    $ cd site
    $ npm install
  3. Edit source/_data/_plugins.yml and add your plugin. For example:

    - name: hexo-server
    description: Server module for Hexo.
    - official
    - server
    - console
  4. Push the branch.

  5. Create a pull request and describe the change.