From 597a28090cb9f5ab228cd27fe4ae47545ced8a88 Mon Sep 17 00:00:00 2001 From: Sam Date: Thu, 28 Jul 2022 18:37:17 -0700 Subject: [PATCH 1/2] Implement reading time based on Joe's implementation --- _includes/reading-time.html | 6 ++++++ _layouts/post.html | 15 ++++++++------- 2 files changed, 14 insertions(+), 7 deletions(-) create mode 100644 _includes/reading-time.html diff --git a/_includes/reading-time.html b/_includes/reading-time.html new file mode 100644 index 0000000..84224f8 --- /dev/null +++ b/_includes/reading-time.html @@ -0,0 +1,6 @@ +{% capture words %} +{{ content | number_of_words | minus: 180 }} +{% endcapture %} +{% unless words contains '-' %} +{{ words | plus: 150 | divided_by: 150 | append: ' minutes to read' }} +{% endunless %} \ No newline at end of file diff --git a/_layouts/post.html b/_layouts/post.html index 57db5bc..1e9098b 100755 --- a/_layouts/post.html +++ b/_layouts/post.html @@ -5,7 +5,7 @@
- + {% if page.video_embed %}
@@ -25,11 +25,11 @@ {%endif %} {% endif %} - + {% if page.video_embed %} {% assign videoInfo = 'post__info-video' %} {% endif %}
@@ -97,7 +98,7 @@

{{ page.title | escape }}

- {% include disqus-comments.html %} + {% include disqus-comments.html %}
From 64795089bcfe87a3a450c67a1618454522ecf312 Mon Sep 17 00:00:00 2001 From: Sam Date: Thu, 28 Jul 2022 18:43:43 -0700 Subject: [PATCH 2/2] Updated article.html w/ reading time --- _includes/article.html | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/_includes/article.html b/_includes/article.html index f4bbf4f..f8a1bfe 100755 --- a/_includes/article.html +++ b/_includes/article.html @@ -33,6 +33,11 @@

{{ post.description }}

{% endif %} +
+ + {% include reading-time.html %} +
+

\ No newline at end of file