-
-
Notifications
You must be signed in to change notification settings - Fork 10.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reading time helper #9200
Labels
feature
[triage] New features we're planning or working on
Comments
aileen
added a commit
to aileen/Ghost
that referenced
this issue
Nov 6, 2017
closes TryGhost#9200 - Registered new server helper `{{reading_time}}`. - Added new global util `word-count` based on the util in Ghost admin, which returns the number of words in an HTML string. - Based on the word count of the post html, the helper calculated the estimated reading time: - 275 words per minute - additional 12 seconds when post has feature image - Renders a string like 'x min red', unless reading time is less than a minute. In this case, the rendered string is '< 1 min read'.
ErisDS
pushed a commit
that referenced
this issue
Nov 6, 2017
closes #9200 - Registered new server helper `{{reading_time}}`. - Added new global util `word-count` based on the util in Ghost admin, which returns the number of words in an HTML string. - Based on the word count of the post html, the helper calculated the estimated reading time: - 275 words per minute - additional 12 seconds when post has feature image - Renders a string like 'x min red', unless reading time is less than a minute. In this case, the rendered string is '< 1 min read'.
I added the
|
kirrg001
pushed a commit
to TryGhost/gscan
that referenced
this issue
Nov 17, 2017
kirrg001
pushed a commit
that referenced
this issue
Mar 5, 2018
refs #9200 - We have not yet counted the images within your html, this commit counts images based on the this algorithm: https://blog.medium.com/read-time-and-you-bc2048ab620c - Added imageCount utility, which counts images using an img-tag regex, amended from the general tag-regex found in wordCount - Added this imageCount to the {{reading_time}} helper, adding 12 seconds to the reading time for every image - The feature image is still counted as before - The first image adds 12 seconds, the second 11, the third 10, and so on - Images from the tenth onwards add 3 seconds to the reading time
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
A common feature on publications nowadays is an indication of how long content will take to read.
This is usually based on a word count divided by an average reading rate, with some modifier based on the number of images.
A good reference is: https://blog.medium.com/read-time-and-you-bc2048ab620c
jQuery plugin as ref: https://github.com/michael-lynch/reading-time (this requires the content to be on the page)
These things all pretty much assume English, but should work okish for other latin languages.
For now (v1):
Implementation should live in the theme layer, e.g. we only do this calculation when the reading time helper is used. If we find more use cases for including statistics, we can do more of this at the API layer & optimise how it works later.
{{reading_time}}
.Thanks to @erikstern-r7 for the use case & reference material.
Potential improvements for later include:
Got a use case for themes? If you have a use case that you can't solve with the existing theme tools, please come tell us about it in #themes.
The text was updated successfully, but these errors were encountered: