Estimated reading time plugin for Flextype
Switch branches/tags
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
languages
CHANGELOG.md
LICENSE.txt
README.md
reading-time.php
reading-time.yaml

README.md

Reading Time Plugin for Flextype

version Flextype MIT License

Estimated reading time plugin for Flextype

Installation

  1. Unzip plugin to the folder /site/plugins/
  2. Go to /site/config/site.yaml and add plugin name to plugins section.
  3. Save your changes.

Example:

...
plugins:
  - reading-time

Usage

Simple usage

<?php namespace Flextype; ?>
<?php echo readingTime($page['content']); ?>

Localization

<?php echo readingTime($page['content'], [
    'minute'  => 'Minute',
    'minutes' => 'Minutes',
    'second'  => 'Second',
    'seconds' => 'Seconds']);
?>

Set custom format of the result

<?php echo readingTime($page['content'], [
    'minute'  => 'Minute',
    'minutes' => 'Minutes',
    'second'  => 'Second',
    'seconds' => 'Seconds',
    'format'  => '{minutes_count} {minutes_label} – {seconds_count} {seconds_label}']);
?>

Enable alternative format that hides the minute label.

<?php echo readingTime($page['content'], [
    'format' => '{minutes_count} {minutes_label}, {seconds_count} {seconds_label}',
    'format.alt' => '{seconds_count} {seconds_label}',
    'format.alt.enable' => true]);
?>

License

See LICENSE