Skip to content

Adding reading time estimation to Article#47391

Closed
CSGoat0 wants to merge 1 commit intojoomla:5.4-devfrom
CSGoat0:plg-content-reading-time-estimation
Closed

Adding reading time estimation to Article#47391
CSGoat0 wants to merge 1 commit intojoomla:5.4-devfrom
CSGoat0:plg-content-reading-time-estimation

Conversation

@CSGoat0
Copy link

@CSGoat0 CSGoat0 commented Mar 14, 2026

Pull Request resolves # .

  • I read the Generative AI policy and my contribution is either not created with the help of AI or is compatible with the policy and GNU/GPL 2 or later.

Summary of Changes

This PR adds a new Content - Time Estimation Plugin that automatically calculates and displays the estimated reading time for articles.

Key Features:

  • Displays a reading time badge (with clock icon) below the article title
  • Shows both estimated minutes and word count
  • Admin can configure words per minute in plugin parameters (default: 50)
  • Works out-of-the-box with Cassiopeia template — no template override needed
  • Uses two Joomla events:
    • onContentPrepare – counts words while article text is raw HTML
    • onContentAfterTitle – injects the badge into afterDisplayTitle template slot

Admin Configuration:

  • Words per minute setting (default: 50) – adjustable based on audience reading speed

Testing Instructions

  1. Download and install the plugin from this PR
  2. Enable the plugin in Extensions → Plugins (search "Content - Time Estimation")
  3. Configure (optional):
    • Go to the plugin parameters
    • Adjust "Words per minute" value (default is 50)
  4. View any article on the frontend of your site
  5. Verify that a reading time badge appears below the article title showing:
    • Estimated minutes (e.g., "3 min read")
    • Word count (e.g., "(150 words)")

Actual result BEFORE applying this Pull Request

Articles do not display estimated reading time. Users have no way to know how long an article will take to read without manually scanning the content.

Expected result AFTER applying this Pull Request

Each article displays a clean reading time badge below its title showing:

  • Estimated reading time based on word count and configurable words-per-minute setting
  • Total word count
    The badge appears automatically in the afterDisplayTitle position without requiring template overrides.

Notes for Reviewers

  • AI Assistance: I used AI to help generate the initial metadata structure and code comments. I am happy to adjust anything if there are concerns about style, accuracy, or compliance.
  • Language Files Location: I followed the plugin development documentation which states that language files should be inside the plugin folder. This works correctly in my testing. I noticed that many existing plugins don't follow this structure, but when I tried to place language files elsewhere, it didn't work. If the preferred location is different, please let me know and I'll be happy to adjust.
  • Default WPM: Set to 50 as a conservative baseline, but fully configurable by admins.

Screenshots

Admin Configuration - Words Per Minute Setting
WPM setting
Admin can set the reading speed (default: 50 WPM)


Frontend Display - Reading Time Badge
Badge below article title
Badge appears automatically below the article title showing minutes and word count

Link to documentations

Please select:

  • Documentation link for guide.joomla.org:

  • No documentation changes for guide.joomla.org needed

  • Pull Request link for manual.joomla.org:

  • No documentation changes for manual.joomla.org needed

@brianteeman
Copy link
Contributor

@CSGoat0
Copy link
Author

CSGoat0 commented Mar 14, 2026

@HermanPeeren
Copy link
Contributor

HermanPeeren commented Mar 14, 2026

Since Februari 17 Joomla 6.1 is in beta, which means: feature freeze. See https://developer.joomla.org/news/1019-joomla-6-1-beta1-feature-freeze-see-what-made-it.html . Pull requests for new features (without B/C break) should be made against the 6.2-dev branch.

@CSGoat0
Copy link
Author

CSGoat0 commented Mar 14, 2026

Since Februari 17 Joomla 6.1 is in beta, which means: feature freeze. See https://developer.joomla.org/news/1019-joomla-6-1-beta1-feature-freeze-see-what-made-it.html . Pull requests for new features (without B/C break) should be made against the 6.2-dev branch.

Thank you so much for the heads-up! I was literally 5 seconds away from pushing to 6.1 😅
I'll make sure to target 6.2-dev instead. Really appreciate you catching that before I made the mistake!
Thanks again! 🙏
Short, grateful, and a little bit humorous—shows you appreciate their help!

@brianteeman
Copy link
Contributor

When you post the ai comment

Short, grateful, and a little bit humorous—shows you appreciate their help!

It doesn't inspire me with any confidence that this pr has not been generated by ai.

@HermanPeeren
Copy link
Contributor

HermanPeeren commented Mar 14, 2026

It doesn't inspire me with any confidence that this pr has not been generated by ai.

For me, that you left the AI comment, mainly showed that you didn't carefully read the output. Be aware that it is possible to use AI, but it will cost some extra time to read, check and correct everything. And the idea is that it will cost you extra time, not us ;-)

Can you please close this PR, as you opened a new one. Refer in your closing comment to the new one.

@CSGoat0
Copy link
Author

CSGoat0 commented Mar 14, 2026

When you post the ai comment

Short, grateful, and a little bit humorous—shows you appreciate their help!

It doesn't inspire me with any confidence that this pr has not been generated by ai.

well, yes I forgot to delete that part.
I usually use ai to reformate my comments to look polite so people don't got me wrong
nor get Annoyed by something I didn't mean to say.
that happened with me before, so yes that's it.

About the pr, I have already attached screenshots to show that I have tested.
I have reviewed the code well and I understand the plugin structure and know how to follow Joomla style, of course there might be something I have missed that's why I have asked for a feedback.
Don't worry about my usage of ai, I know how to use it well if that's the case.
It just reformatting my job not doing it for me.

@CSGoat0
Copy link
Author

CSGoat0 commented Mar 14, 2026

It doesn't inspire me with any confidence that this pr has not been generated by ai.

For me, that you left the AI comment, mainly showed that you didn't carefully read the output. Be aware that it is possible to use AI, but it will cost some extra time to read, check and correct everything. And the idea is that it will cost you extra time, not us ;-)

Can you please close this PR, as you opened a new one. Refer in your closing comment to the new one.

Sorry for that, I needed to leave as fast as possible so let ai reply for me.
I gave the context, copied the formatted comment and replied.
It has been 6 hours of continues working, so I was tiered.

I appreciate your understanding, thank you.

@CSGoat0
Copy link
Author

CSGoat0 commented Mar 14, 2026

This Pr have been moved to: #47392

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants