LouisBarranqueiro / hexo-theme-tranquilpeak

:lipstick: A gorgeous responsive theme for Hexo blog framework
https://louisbarranqueiro.github.io/hexo-theme-tranquilpeak/
GNU General Public License v3.0
1.86k stars 484 forks source link

Reading time #554

Closed LouisBarranqueiro closed 1 year ago

LouisBarranqueiro commented 5 years ago

Description

Then the reading time will be displayed along with the other metadata:

Screen Shot 2019-06-09 at 12 21 21 PM

Explanation / motivation

Motivate users to read posts because they know how long it will take.

Additional information

fletchto99 commented 5 years 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.

itpropro commented 5 years ago

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>
chrisjwelly commented 4 years ago

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

bmitchinson commented 4 years ago

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

chrisjwelly commented 4 years ago

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!

bmitchinson commented 4 years ago

@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:

chrisjwelly commented 4 years ago

Thanks @bmitchinson . I managed to get it working. I appreciate your help!

LouisBarranqueiro commented 1 year ago

Closing this issue as I will not add new features to the theme. It is in maintenance mode.