Adds nofollow attribute to all external links in your hexo blog posts automatically.
Clone or download
Pull request Compare This branch is 18 commits ahead of liuzc:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib
.gitignore
.npmignore
.travis.yml
LICENSE
README.md
index.js
package.json

README.md

hexo-nofollow

npm version Build Status NPM Dependencies Known Vulnerabilities Greenkeeper badge

This project is based on hexo-autonofollow

Adds nofollow attribute to all external links in your hexo blog posts automatically.

The original package has not been updated for a while. Its outdated dependency has a minor vulnerability.

All the options are the same, so you can use this as a drop-in replacement.

Features

  • Add rel="external nofollow noopener noreferrer" to all external links, SEO friendly.
  • Add target="_blank", Open external links in new window or tab. This can be disabled, see below.

Hexo doesn't insert target="_blank" to all external links even if you set external_link: true (default value) in the _config.yml. This plugin make sure all external links are processed.

For example,

[example-link](https://example.com)

Becomes,

<a href="https://example.com" rel="external nofollow noopener noreferrer" target="_blank">example-link</a>

Install

$ npm install hexo-nofollow --save

Usage

To enable this plugin, insert the following to _config.yml:

nofollow:
  enable: true

To exclude certain links, see below.

Options

nofollow:
  enable: true
  exclude:
    - exclude1.com
    - exclude2.com
external_link: true
  • enable - Enable the plugin. Defaults to false.
  • exclude - Exclude hostname.
  • external_link - Add target="_blank". Defaults to true.

Note: external_link setting is already in the default _config.yml. Only add it if you can't find it.

Credits

All credits go to the following work: