monkeyWzr / hugo-theme-cactus

Cactus theme for hugo
MIT License
537 stars 338 forks source link

Add Reading Time to each post #41

Closed amdjml closed 3 years ago

amdjml commented 3 years ago

How can I add "Reading Time" to each posts?

ungeschneuer commented 3 years ago

This area is not really a support desk but I just saw the question browsing by. Reading time is not implemented in this theme but not that hard to add. You would basically count the words of an entry and divide it by the words per minute a person normally reads. The right template for that would be in cactus/layouts/posts/single.html. Here is a instruction for the code, you would need to add it yourself at the right place. https://kodify.net/hugo/strings/reading-time-text/

switchswap commented 3 years ago

I was actually looking to add the same thing and I used @ungeschneuer's link to implement this.

Here's a screenshot on the dark theme (though I made it work for all themes): firefox_2021-04-04_05-06-12

If it looks appropriate, I'd be happy to submit a PR :)

ungeschneuer commented 3 years ago

Sounds interesting. Would be probably best to make it optional via variable in the config file.

switchswap commented 3 years ago

Ah, I actually did that too via a showReadTime boolean.

Edit: I just created a PR @ #42

monkeyWzr commented 3 years ago

Thank you all! Merged #42