diff --git a/scripts/generators/search.js b/scripts/generators/search.js index 218eb2e..1bedfd3 100644 --- a/scripts/generators/search.js +++ b/scripts/generators/search.js @@ -31,11 +31,13 @@ hexo.extend.generator.register('search_json_generator', function (locals) { temp_post.path = root + post.path } if (cfg.content != false && post.content) { - var content = stripHTML(post.content).trim() + var content = stripHTML(post.content.replace(/\d+<\/span>/g, '')).trim() // 部分HTML标签 content = content.replace(//g, '') content = content.replace(/
/g, '') content = content.replace(/
/g, '') + // 去除HTML实体 + content = content.replace(/&[^\s;]+;/g, "") // 换行符换成空格 content = content.replace(/\\n/g, ' ') content = content.replace(/\n/g, ' ')