feat: WordCount
This commit is contained in:
13
scripts/filters/index.js
Normal file
13
scripts/filters/index.js
Normal file
@@ -0,0 +1,13 @@
|
||||
'use strict';
|
||||
|
||||
const metaGeneratorPath = './meta_generator';
|
||||
|
||||
module.exports = hexo => {
|
||||
/* const {
|
||||
filter
|
||||
} = hexo.extend; */
|
||||
// filter.register('after_render:html', require('./meta_generator'));
|
||||
};
|
||||
|
||||
// 保持过滤器最先执行
|
||||
hexo.extend.filter.register('after_render:html', require(metaGeneratorPath), 1);
|
17
scripts/filters/meta_generator.js
Normal file
17
scripts/filters/meta_generator.js
Normal file
@@ -0,0 +1,17 @@
|
||||
'use strict';
|
||||
|
||||
const defaultConfig = require('../default_config');
|
||||
|
||||
function hexoMetaGeneratorInject(data) {
|
||||
const config = defaultConfig;
|
||||
if (!config.meta_generator || !data ||
|
||||
data.match(/<meta\s+name=['|"]?generator['|"]?/i)) {
|
||||
return;
|
||||
}
|
||||
|
||||
const hexoGeneratorTag = `\n <meta name="generator" content="hexo-theme-yilia-plus">`;
|
||||
|
||||
return data.replace('</title>', '</title>' + hexoGeneratorTag);
|
||||
}
|
||||
|
||||
module.exports = hexoMetaGeneratorInject;
|
Reference in New Issue
Block a user