Top Hexo plugins recommended

Hexo plugins

hexo-generator-minify

This plugin is used to minify CSS / Javascript code.

Install:

1
npm install hexo-generator-minify --save

Run:

1
hexo gm --cssSafe

hexo-generator-sitemap

1
npm install hexo-generator-sitemap --save

It generates sitemap and save it to sitemap.xml. If you want to save to another file, then configure it in _config.yml:

1
2
sitemap:
path: sitemap.xml

hexo-autonofollow

This plugin is used to add rel=”external nofollow” to external links.

1
npm install hexo-autonofollow --save

You may need to modify _config.yml:

1
2
3
4
nofollow:
enable: true
exclude:
- www.yuxifan.com

hexo-generator-feed

This plugin is used to genearte rss/atom feed.

Install:

1
npm install hexo-generator-feed --save

Configuration:

1
2
3
4
feed:
type: atom
path: atom.xml
limit: 20

hexo-generator-json-content

This plugin is used to genearte json content which is required by on-site search

1
npm install hexo-generator-json-content --save

The generated content.json may get bigger and bigger while the site contents grow. You may want to use title / keywords ONLY for the generated json file.

Then, you may need to add keyword fileds for your posts. Also modify file: node_modules/hexo-generator-json-content/index.js

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
if (posts) {
var postsPropertyNames = Object.getOwnPropertyNames(posts).filter(function (item) {
return posts[item];
});
content = site.posts.sort('-date').filter(function (post) {
return post.published;
}).map(function (post) {
var actualPost = {};
postsPropertyNames.forEach(function(item){
if (item === 'excerpt') {
actualPost[item] = minify(post.excerpt);
} else if (item === 'text') {
if(post.keywords) {
actualPost[item] = minify(post.keywords);
}else if(post.description) {
actualPost[item] = minify(post.description);
}else {
actualPost[item] = minify(post.title);
}
} else if (item === 'categories') {
actualPost[item] = post.categories.map(function (cat) {
return {
name: cat.name,
slug: cat.slug,
permalink: cat.permalink
};
});
} else if (item === 'tags') {
actualPost[item] = post.tags.map(function (tag) {
return {
name: tag.name,
slug: tag.slug,
permalink: tag.permalink
};
});
} else if (item === 'keywords' && cfg.keywords) {
actualPost[item] = getKeywords(minify(post.excerpt));
} else {
actualPost[item] = post[item];
}
});
return actualPost;
});

If cannot install Hexo/plugins in Ubuntu 14,

Try:

1
sudo apt-get install nodejs-legacy

Install Hexo in Ubuntu 16.04LTS

1
2
3
4
5
6
cd ~
curl -sL https://deb.nodesource.com/setup_6.x -o nodesource_setup.sh
sudo bash nodesource_setup.sh
sudo apt-get install nodejs
sudo npm install hexo-cli -g
Share