Closed ukityh closed 3 years ago
这个你需要改 hexo-wordcount 插件代码了。 定位到:https://github.com/willin/hexo-wordcount/blob/ccceed3df38cc1529ba7bd067d72f8a440ae94a2/index.js#L29
hexo.extend.helper.register('totalcount', function (site) {
var count = 0;
site.posts.forEach(function (post) {
// 判断下 post.origin 是否有值,有的话用 origin 来计算
var len = post.origin ? counter(post.origin) : counter(post.content);
count += len[0] + len[1];
});
if (count < 1000) {
return count;
}
return Math.round(count / 100) / 10 + 'k';
});
没有测试,大概意思就是这样,你可以尝试下。
噢噢噢!!是可以的!!非常感谢!!
字数统计错误
通过给文章添加了判断句,可以统计出正确字数,然而站点总字数的统计依旧统计的是文档加密后的字数。
请问有办法解决吗?