Node read time
Displays estimated reading time for node content based on word count and configurable words-per-minute settings.
node_read_time
Install
composer require 'drupal/node_read_time:8.x-1.15'
Overview
The Node Read Time module provides reading time estimation functionality for Drupal nodes. It calculates and displays to users the estimated time it will take to read a piece of content, making it ideal for blogs, news sites, and any content-heavy websites.
The module analyzes all text-based fields including regular text fields, long text, text with summary, and even content from entity reference revision fields like Paragraphs and Custom Blocks. Reading time can be enabled on a per-content-type basis and supports customizable words-per-minute calculations to accommodate different audience reading speeds.
Reading time can be displayed in multiple formats: minutes only, minutes with seconds, or a smart format that shows "1 minute" for short content. Additionally, content editors can manually override the calculated reading time when needed.
Features
- Calculates and displays estimated reading time for node content based on configurable words-per-minute settings
- Supports per-content-type activation allowing fine-grained control over which content types display reading time
- Analyzes multiple field types including text, text_long, text_with_summary, string_long, and entity_reference_revisions (Paragraphs, Custom Blocks)
- Provides four time display formats: numeric only, minutes only, minutes with seconds, and smart display
- Includes manual override field allowing content editors to set custom reading times
- Integrates with Views module providing a custom field handler for building custom reading time displays
- Adds reading time as an extra display field that can be positioned via the Manage Display interface
- Provides a computed entity field accessible programmatically via node_read_time property
Use Cases
Blog with Reading Time Display
Enable reading time for the Article content type to show readers how long each blog post will take to read. Configure 225 WPM for general audiences or adjust for technical content that may require slower reading. Position the reading time field near the article title or publication date using Manage Display.
News Site with Quick Scan Indicators
Use the 'Minute and Second' format on news articles to give readers precise time estimates. This helps users decide which articles to read during limited time. Configure in Views to display reading time in teaser listings.
Educational Content with Custom Reading Speeds
For technical documentation or educational materials, lower the words per minute to 180-200 to account for more careful reading. Use the override field for complex articles that may require additional time for understanding diagrams or code examples.
Content with Embedded Media
For articles that include videos or interactive elements, use the override field to add extra time to the calculated reading time. Content editors can manually set a more accurate total engagement time that accounts for watching embedded videos.
Views-based Content Listings
Create a custom View of articles that includes reading time as a sortable field. This allows visitors to filter or sort content by reading time, choosing quick reads for short breaks or longer pieces for in-depth reading sessions.
Tips
- The average adult reads at 200-250 words per minute. Use 225 WPM as a starting point and adjust based on your audience's reading level and content complexity.
- For technical or code-heavy content, consider lowering WPM to 150-180 to account for more careful reading.
- Use the override field for content with non-text elements like videos or interactive components that require additional engagement time.
- The reading time can be rendered in Twig templates using {{ content.reading_time }} for more precise placement control.
- When using Paragraphs, all nested text content is automatically included in the reading time calculation.
- The module strips HTML tags and excludes iframe and script tags from word count calculations for accurate estimates.
Technical Details
Admin Pages 1
/admin/config/content/reading-time
Configure reading time calculation settings including words per minute, time display format, and enable reading time for specific content types.
Permissions 1
Hooks 6
hook_entity_extra_field_info
Registers 'reading_time' as an extra display field for node entities. This allows the reading time to appear in the Manage Display interface.
hook_node_view
Renders the reading time when a node is displayed. Checks if reading time is enabled for the content type and either uses the override value or calculates reading time using the service.
hook_theme
Registers the 'reading_time' theme hook with associated template and variables.
hook_views_data_alter
Adds a custom Views field handler for displaying reading time in Views.
hook_entity_base_field_info
Adds the 'node_read_time_override' base field to node entities, allowing content editors to manually set a reading time value.
hook_entity_base_field_info_alter
Adds the computed 'node_read_time' field to node entities, providing programmatic access to the calculated reading time.
Troubleshooting 4
First verify that reading time is enabled for the content type at /admin/config/content/reading-time. Then go to Structure > Content types > [Type] > Manage display and ensure the 'Reading time' field is visible (not hidden) and positioned where you want it to appear.
Check that the content is using supported field types (text, text_long, text_with_summary, string_long). Content in custom field types or certain formatted text may not be collected. Also verify that Paragraph fields are using entity_reference_revisions type.
Ensure your user role has the 'Administer reading time' permission at /admin/people/permissions. Site administrators automatically receive this permission during module updates.
If using the override field, ensure the value is in the expected format. For calculated values, clear Drupal caches to ensure the Views field handler is using current configuration.