commit
91a41e0077
|
@ -10,11 +10,6 @@
|
||||||
"default": "/img/favicon.svg",
|
"default": "/img/favicon.svg",
|
||||||
"nullable": true
|
"nullable": true
|
||||||
},
|
},
|
||||||
"canonical_url": {
|
|
||||||
"type": "string",
|
|
||||||
"description": "Canonical URL of the current page",
|
|
||||||
"nullable": true
|
|
||||||
},
|
|
||||||
"open_graph": {
|
"open_graph": {
|
||||||
"$ref": "/misc/open_graph.json"
|
"$ref": "/misc/open_graph.json"
|
||||||
},
|
},
|
||||||
|
|
|
@ -8,6 +8,9 @@ const Comment = require('./comment');
|
||||||
* Get the word count of text.
|
* Get the word count of text.
|
||||||
*/
|
*/
|
||||||
function getWordCount(content) {
|
function getWordCount(content) {
|
||||||
|
if (typeof content === 'undefined') {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
content = content.replace(/<\/?[a-z][^>]*>/gi, '');
|
content = content.replace(/<\/?[a-z][^>]*>/gi, '');
|
||||||
content = content.trim();
|
content = content.trim();
|
||||||
return content ? (content.match(/[\u00ff-\uffff]|[a-zA-Z]+/g) || []).length : 0;
|
return content ? (content.match(/[\u00ff-\uffff]|[a-zA-Z]+/g) || []).length : 0;
|
||||||
|
|
Loading…
Reference in New Issue