278

Product support

Visit this product's website for support.

Categories

Component view

Blog Time to Read adds a basic time to read calculation for your awesome posts.

Requirements

The Blog Time to Read plugin requires RainLab Blog and RainLab Translate.

Settings

Plugin defaults are controlled via backend settings panel, just look for Blog Time to Read in your Settings dashboard. Currently you can set default reading speed (words per minute, the initial value is 300 wpm) and result rounding to the closest higher integer (it is enabled by default).

Implementing Frontend Pages

The Blog Time to Read plugin provides several ways to get time to read for your blog post:

  1. The default Post model is extended with timeToRead property which gives you a number in minutes to read the post. The default settings are being used for calculation.

    {{ post.timeToRead }}

  2. Templates can use a new Twig timeToRead filter which uses the initial settings by default but also allows to override them explicitly (the example shows how you can set 100 wpm speed without rounding for a filter).

    {{ post.content | timetToRead(100, false) }}

  3. TimeToRead component is available for use.

    Component properties:

    • Post slug - get time to read for the post specified by the slug value from URL parameter;
    • Default reading speed - words per minute by default;
    • Rounding up - round fractional values to the next highest integer value.

Please note that default component partial contains the call to translation filter.

<div>
<p>{{ ":count min to read" |_({ count: __SELF__.minutes }) }}</p>
</div>

It allows you to edit the message using the Translate plugin and specify messages for different languages too.

1.2.1

Move settings into blog category

Sep 06, 2019

1.2.0

Minor README changes; another style to list required plugins

Jan 09, 2019

1.1.0

Degraded from PHP7.1 to PHP7.0 to support the minimal required version for October CMS.

Nov 27, 2018

1.0.1

Fixed typo in README

Nov 27, 2018

1.0.0

The initial release of Blog Time to Read

Aug 23, 2018