diff --git a/layout/_partial/article-meta-info.ejs b/layout/_partial/article-meta-info.ejs index e13b95b..88df737 100644 --- a/layout/_partial/article-meta-info.ejs +++ b/layout/_partial/article-meta-info.ejs @@ -26,14 +26,25 @@ <% } %> - <% if(is_post() && theme.post_wordcount.enable && theme.post_wordcount.wordcount){ %> + + <% + let temp_wordcount_count, temp_min2read_count = null; + try { + temp_wordcount_count = wordcount(page.content); + temp_min2read_count = min2read(page.content); + } catch (e) { + temp_wordcount_count = 0; + temp_min2read_count = 0; + } + %> + <% if(is_post() && theme.post_wordcount.enable && theme.post_wordcount.wordcount && temp_wordcount_count){ %> - <%= wordcount(page.content) %> <%- __('wordcount') %> + <%= temp_wordcount_count %> <%- __('wordcount') %> <% } %> - <% if(is_post() && theme.post_wordcount.enable && theme.post_wordcount.min2read){ %> + <% if(is_post() && theme.post_wordcount.enable && theme.post_wordcount.min2read && temp_min2read_count){ %> - <%= min2read(page.content) %> <%- __('min2read') %> + <%= temp_min2read_count %> <%- __('min2read') %> <% } %> <% if (is_post() && theme.website_count.busuanzi_count.enable && theme.website_count.busuanzi_count.page_pv) { %>