Jump to content

Recommended Posts

Posted

As we are used to such a busy lifestyle time is a precious commodity.  It would be useful, for Pages content, to have an estimated reading time for each article.  I know this has been done on another platform, but as to the criteria for estimating the time taken to read is something that would need to be calibrated.  Having an estimated time of reading may have a positive impact on whether someone will read an article or skip it if it 'appears' too long.  Thoughts?

Posted

Edit the database template Displate -> Record

Add this anywhere (change the 200 to what you believe the 'words per minute' speed is for someone reading):

{{$wordCount = \str_word_count(\strip_tags($record->_content));}}
{{$estimateTime = \ceil ($wordCount/200);}}

Then add this in your desired place in the template:

Estimated reading time: {$estimateTime} minutes

 

Posted (edited)
1 hour ago, Nathan Explosion said:

Edit the database template Displate -> Record

No need to edit template. Custom field would do the same 😉

screenshot-2022_02.05-19_28_42.thumb.png.1bd3cca2005ee1946abe52979319dc96.png

Pay attention to Default Value! It has to be filled out in order of the field to be displayed.

 

screenshot-2022_02.05-19_27_53.png.bf582edd98d56440ec2f79e94e57fc2d.png

 

Edited by Sonya*
Posted

Brilliant responses and thank you all, this will be most helpful in encouraging people to actually put some time aside to read the published articles knowing roughly how long it will take to read. 

Simon Cowell GIF by America's Got Talent

Posted
2 hours ago, Nathan Explosion said:

Edit the database template Displate -> Record

Add this anywhere (change the 200 to what you believe the 'words per minute' speed is for someone reading):

{{$wordCount = \str_word_count(\strip_tags($record->_content));}}
{{$estimateTime = \ceil ($wordCount/200);}}

Then add this in your desired place in the template:

Estimated reading time: {$estimateTime} minutes

 

Brilliant. Who’s going to create a mini plugin hooking into IPS\Content adding a get__readtime method 🔥🔥🔥😂

Posted
4 hours ago, Daniel F said:

Brilliant. Who’s going to create a mini plugin hooking into IPS\Content adding a get__readtime method 🔥🔥🔥😂

I already did this Daniel.

I was going to release it to the public, however due to a hard disk failure, cloud sync error and a drunken night in where I feed large quantities of alcohol into my floppy disk bay, I lost all the code.

You know, all the normally excu... issues we developers face daily.

Posted

Works like a charm, but I had to use the code rather than a custom field as I use @opentype Supergrid plugin and templates and had to add it to the Frontpage entry template.

image.png.af92381cfd49591aa80d9e1872ca7d33.png

The custom field method added the time to the actual article and when choosing the listing option it add the time to the top right of the image and was difficult to read depending on whether the image background matched the text colour.

The tricky aspect of using the code was to find out which template it needed to sit in, but with a bit of detective work using the browser console it was tracked down and works great.

Thanks again to everyone who contributed to the solution, very much appreciated.

Thank U Reaction GIF by BROCKHAMPTON

Posted (edited)
16 hours ago, Daniel F said:

Brilliant. Who’s going to create a mini plugin hooking into IPS\Content adding a get__readtime method 🔥🔥🔥😂

As you asked so nicely...pluralized language string included:

Example in Pages:

{$record->get__readtime($record->_content,200)}

image.thumb.png.6985ca5336337c261b4009d42c32dd02.png

 

 

(NE) get__readtime() 1.0.0.xml

Edited by Nathan Explosion
Posted
4 minutes ago, Ocean West said:

Or even a button to read this article to me option that would select your content and use your computers text to speech. 

No need for a plugin, that’s already possible in most OS/browsers 

Posted
23 hours ago, Daniel F said:

No need for a plugin, that’s already possible in most OS/browsers 

oh I know but you still have to manually select the text to read - some devices are easier then others. 

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...