[Hexo] Use hexo-filter-nofollow plugin to add nofollow attribute to all external links automatically in Hexo
hexo-filter-nofollow
Hexo is a fast, simple & powerful blog framework. It use plugins to provide features powerful APIs for limitless extensibility. Various plugins are available to support most template engines (EJS, Pug, Nunjucks, and many others). Easily integrate with existing NPM packages (Babel, PostCSS, Less/Sass, etc).
hexo-filter-nofollow
plugin add nofollow
attribute to all external links automatically.
hexo-filter-nofollow
add `rel=“noopener external nofollow noreferrer” to all external links for security, privacy and SEO. Read more.
Installation
Use npm
to install hexo-filter-nofollow
package.
1 | npm install hexo-filter-nofollow --save |
Configuration
It will generate sitemap.xml in the public folder by default after hexo-filter-nofollow
installation.
You can configure this plugin in ./_config.yml.
1 | nofollow: |
The follow is the options:
-
enable - Enable the plugin. Default value is true.
-
field - The scope you want the plugin to proceed, can be ‘site’ or ‘post’. Default value is site.
-
‘post’ - Only add nofollow attribute to external links in your post content
-
‘site’ - Add nofollow attribute to external links of whole sites
-
-
exclude - Exclude hostname. Specify subdomain when applicable, including www. ‘exclude1.com’ does not apply to www.exclude1.com nor en.exclude1.com.
Finally, you can visit your site in the browser, and check whether the site works correctly after Hexo restarted or regenerated.