From e10871b8aea5f46ce040eb9f4a8605a3039b6ac8 Mon Sep 17 00:00:00 2001 From: eggy Date: Wed, 14 Apr 2021 15:23:11 -0400 Subject: [PATCH] use word count to get read time estimate --- .eleventy.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.eleventy.js b/.eleventy.js index cb701ca..680d75d 100644 --- a/.eleventy.js +++ b/.eleventy.js @@ -23,8 +23,8 @@ module.exports = function(eleventyConfig) { // To create a filter to determine duration of post eleventyConfig.addFilter('readTime', (value) => { const content = value - const textOnly = content.replace(/(<([^>]+)>)/gi, '') - const readingSpeedPerMin = 450 + const textOnly = content.split(" ")//content.replace(/(<([^>]+)>)/gi, '') + const readingSpeedPerMin = 300 return Math.max(1, Math.floor(textOnly.length / readingSpeedPerMin)) })