Skip to content

Commit 3176fe0

Browse files
authored
Merge pull request #3667 from SukkaW/meta-generator-config
fix: performance improvements when meta_generator is disabled
2 parents 48b506d + 66fa0e7 commit 3176fe0

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

lib/plugins/filter/meta_generator.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,14 @@ let cheerio;
44
const hexoGeneratorTag = '<meta name="generator" content="Hexo %s" />';
55

66
function hexoMetaGeneratorInject(data) {
7+
const { config } = this;
8+
if (!config.meta_generator) return;
9+
710
if (!cheerio) cheerio = require('cheerio');
811
const $ = cheerio.load(data, {decodeEntities: false});
9-
const { config } = this;
1012

1113
if (!($('meta[name="generator"]').length > 0) &&
12-
$('head').contents().length > 0 &&
13-
config.meta_generator) {
14+
$('head').contents().length > 0) {
1415
$('head').prepend(hexoGeneratorTag.replace('%s', this.version));
1516

1617
return $.html();

0 commit comments

Comments
 (0)