Closed LouisBarranqueiro closed 1 year ago
I believe there is interest in a feature like this. It looks like this feature was attempted to be implemented before in #457. Furthermore, @bmitchinson also seemed quite interested in a feature such as this.
Aside from the motivations you posted, my original motivation behind this feature change was the fact that medium, a common blogging platform, displays a reading time at the top. Medium supports reading times across multiple languages, and as it turn out they actually detail their rather simple algorithm. Something like that could be quite easy to implement and easily build upon https://github.com/LouisBarranqueiro/hexo-theme-tranquilpeak/pull/541.
Taken from Medium's FAQ:
Read time is based on the average reading speed of an adult (roughly 265 WPM). We take the total word count of a post and translate it into minutes, with an adjustment made for images. For posts in Chinese, Japanese and Korean, it's a function of number of characters (500 characters/min) with an adjustment made for images.
While the implementation in #541 doesn't take into account images that should be rather easy to adjust for.
Medium actually goes into more detail about their algorithm in a blog post on their main blog.
I already use that with tranquilpeak. We just added hexo-wordcount
as package and added this to post/meta.ejs:
<div><span class="post-count"><%= wordcount(post.content) %> words · <%= min2read(post.content) %> min to read</span></div>
Hi @itpropro , I'm trying to add hexo-wordcount
to my blog as well. Facing difficulties in setting it up. In which directory is post/meta.ejs
located? I'm currently interpreting it as <postname>/meta.ejs
and it is giving me a reference error
Mine has it enabled if you'd like it for reference. Would dig in more to help but have finals to study for https://github.com/bmitchinson/mitchinson.dev
Mine has it enabled if you'd like it for reference. Would dig in more to help but have finals to study for https://github.com/bmitchinson/mitchinson.dev
Thanks @bmitchinson ! I had a quick look and did a global search on some keywords like "count", "wordcount", "readingtime". However, I couldn't really find anything as to how the reading time is enabled.
Any help would be greatly appreciated. No urgency, though. Please study for your finals first!
@chrisjwelly
Should have linked to my fork of the theme and not the site itself, apologies.
See these:
These should be all you'll need to add.
I got those changes from pulling in this PR from fletchto99 that was rejected https://github.com/LouisBarranqueiro/hexo-theme-tranquilpeak/pull/541.
I agree with louis that it shouldn't be merged in until it supports all languages, but I don't mind the implementation for my own site:
Thanks @bmitchinson . I managed to get it working. I appreciate your help!
Closing this issue as I will not add new features to the theme. It is in maintenance mode.
Description
reading_time
variable in the front-matter of posts so users can manually enter the reading time of their posts.Then the reading time will be displayed along with the other metadata:
Explanation / motivation
Motivate users to read posts because they know how long it will take.
Additional information