UNPKG

437 BJavaScriptView Raw
1'use strict';
2
3let cheerio;
4const hexoGeneratorTag = '<meta name="generator" content="Hexo %s" />';
5
6function hexoMetaGeneratorInject(data) {
7 if (!cheerio) cheerio = require('cheerio');
8 const $ = cheerio.load(data, {decodeEntities: false});
9
10 if (!($('meta[name="generator"]').length > 0)) {
11 $('head').prepend(hexoGeneratorTag.replace('%s', this.version));
12
13 return $.html();
14 }
15}
16
17module.exports = hexoMetaGeneratorInject;