From 48d4da4f1b0ee6d8a095fca301e6f3486a35f0b2 Mon Sep 17 00:00:00 2001 From: jeffreytse Date: Mon, 11 Jan 2021 11:18:35 +0800 Subject: fix: reading time was incorrect for cjk words (#20) The liquid filter `number_of_words` is for english words, so here we use a calculation to estimate accurately the words, especially when the language is not English. --- _includes/views/pagination.html | 1 + _includes/views/post-header.html | 1 + 2 files changed, 2 insertions(+) (limited to '_includes/views') diff --git a/_includes/views/pagination.html b/_includes/views/pagination.html index bcc3620..c1814e3 100644 --- a/_includes/views/pagination.html +++ b/_includes/views/pagination.html @@ -13,6 +13,7 @@ {%- assign date_format = site.yat.date_format | default: "%b %-d, %Y" -%} {% assign article = post.content %} + {% assign lang = post.lang %} {%- include functions.html func='get_reading_time' -%} {% assign reading_time = return %} diff --git a/_includes/views/post-header.html b/_includes/views/post-header.html index df6447b..e59fd91 100644 --- a/_includes/views/post-header.html +++ b/_includes/views/post-header.html @@ -9,6 +9,7 @@ {% assign article = page.content %} + {% assign lang = page.lang %} {%- include functions.html func='get_reading_time' -%} {% assign reading_time = return %} {{ reading_time }} -- cgit v1.2.3