Skip to content

Commit

Permalink
fix: wrong English word count by avoiding eliminating spaces.
Browse files Browse the repository at this point in the history
  • Loading branch information
LucisUrbe committed Sep 27, 2024
1 parent 94049b2 commit ab27920
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion scripts/helpers/wordcount.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const { stripHTML } = require('hexo-util');

const getWordCount = (post) => {
// post.origin is the original post content of hexo-blog-encrypt
const content = stripHTML(post.origin || post.content).replace(/\r?\n|\r/g, '').replace(/\s+/g, '');
const content = stripHTML(post.origin || post.content).replace(/\r?\n|\r/g, '').trim();

if (!post.wordcount) {
const zhCount = (content.match(/[\u4E00-\u9FA5]/g) || []).length;
Expand Down

0 comments on commit ab27920

Please sign in to comment.