Adding Reading Time Estimation to Article#47392
Adding Reading Time Estimation to Article#47392CSGoat0 wants to merge 46 commits intojoomla:6.2-devfrom
Conversation
1. Removes the need for a seperate rtl css stylesheet 2. Stops reversing the hours/minutes cell
--------- Co-authored-by: Harald Leithner <leithner@itronic.at> Co-authored-by: Stefan Wendhausen <stefan.wendhausen@tec-promotion.de>
Signed-off-by: BrianTeeman <brian@teeman.net>
This template allows users to submit detailed bug reports, including contact details, expected outcomes, software version, browser information, relevant logs, and agreement to the Code of Conduct.
Updated the bug report template to improve clarity and streamline the information requested.
Changed the default version from 5.4 to 0 in the bug report template.
Fix typo in expected result description.
Updated the accessibility issue template to YAML format with structured fields for better reporting.
…e-chooser [5.4] Maintenance Task: Disable blank issue template
|
You are trying to merge a pull requests from your branch which is joomla 5.4 into 6.2. that's why you have so many changes Please note that it is expected that you have actually tested to see if the code you are proposing works!! |
| ; Plugin metadata (shown in Extensions Manager) | ||
| PLG_CONTENT_TIMEESTIMATION="Content - Time Estimation" | ||
| PLG_CONTENT_TIMEESTIMATION_DESCRIPTION="Displays an estimated reading time before each article, based on a configurable words-per-minute reading speed." | ||
|
|
There was a problem hiding this comment.
The sys.ini file only contains language strings for when the plugin is not yet loaded. So the strings under this line are not necessary in this file.
There was a problem hiding this comment.
You are right, I just followed the Plugins structure, they mostly contained those 2 files with duplicates so didn't give it much time to think.
I will remove those strings.
| use Joomla\CMS\Plugin\PluginHelper; | ||
| use Joomla\DI\Container; | ||
| use Joomla\DI\ServiceProviderInterface; | ||
| use Joomla\Event\DispatcherInterface; |
There was a problem hiding this comment.
Put use clauses in alphabetical order.
| /** | ||
| * Map Joomla events → listener methods. | ||
| * | ||
| * @return array |
There was a problem hiding this comment.
AFAIK the @since tag is obligated in Joomla core docblocks.
| $minLabel = $minutes === 1 ? 'min read' : 'mins read'; | ||
|
|
||
| return '<div class="reading-time-badge">' | ||
| . '<span>🕑 <strong>' . $minutes . '</strong> ' . $minLabel . '</span>' |
There was a problem hiding this comment.
Isn't this too much inline styling?
There was a problem hiding this comment.
do you suggest removing them to a temp file?
| type="text" | ||
| label="PLG_CONTENT_TIMEESTIMATION_WPM_LABEL" | ||
| description="PLG_CONTENT_TIMEESTIMATION_WPM_DESC" | ||
| default="200" |
There was a problem hiding this comment.
Why do you have a default of 200 here and a (fallback) default in the plugin of 50? I'd expect them both the same, a reasonable default.
There was a problem hiding this comment.
Why do you have a default of 200 here and a (fallback) default in the plugin of 50? I'd expect them both the same, a reasonable default.
Thank you for catching that, I intended to set the default to 200. I thought this would be so fast then changed to 50 and tested. Everything worked fine, I have missed that one.
I will handle it.
| { | ||
| $text = strip_tags($html); | ||
| $text = html_entity_decode($text, ENT_QUOTES, 'UTF-8'); | ||
| $text = preg_replace('/\s+/', ' ', trim($text)); |
There was a problem hiding this comment.
Why this line? A word in str_word_count() is any sequence of alphabetic characters, so multiple whitespace characters are ignored.
|
The team decided to discuss this further, thus I'm opening it back up again. |
It works perfectly! I have tested it. |
Great, thank you! |
|
Developing a plugin for including in the core is not the same as a standalone extension. It can't work as you are missing the SQL to install the plugin on new sites and the SQL to install the plugin on upgraded sites. The language files should be moved where all the other plugin language files are eg administrator/languages/en-gb Your test instructions to "download and install" are not possible which you would know if you tried to follow the instructions. Finally you need to fix your branch as already explained I am sorry but I do not believe your statement that you only used ai to write the comments |
You can see in my pr that I have mentioned that I have tried to add the language files with the others and it didn't work. you can find that part under: Notes for Reviewers About trusting me, don't worry, I know that you might be saying that because you have suffered from vipe coding, well me too. The task from GSOC was also all by myself; I have discussed it and if that was an AI they would have known as I literally used another approach that I have found in the documentation. That's why I have a good understanding of the plugins. |
|
Sorry not wasting my time any more. You're not reading |
You said that if I read the instructions I wouldn't add the language file in the plugin. I was just explaining that I added that and said in the pr it might be wrong as it goes against the other plugins and I requested a feedback on that from someone with a better understanding as I am new. Didn't mean that you didn't just explain that, I have read and understood you comment and thanked you for the feedback on lang files (that I requesting in the pr already). Anyways, I appreciate your time. |
Nowhere did I say that |
This line I was referring to, that's why I sometimes refine my comments to give only the meaning I want, of course if you didn't mean that. |
|
I've already given you feedback,you just chose to ignore it. |
My bad, I am sorry. I will be reaching out soon to understand how to can I fix this: "It can't work as you are missing the SQL to install the plugin on new sites and the SQL to install the plugin on upgraded sites." |
|
To get a better understanding of what the sql looks like etc when adding a new plugin to Joomla take a look at https://github.com/joomla/joomla-cms/pull/46514/changes |
|
@CSGoat0 It makes no sense to try to do e the conflicts in this PR. It will not work as you have made this PR here with a branch which is based in the 5.4-dev branch, it you propose the PR for the 6.0-dev branch. This cannot work and cannot be fixed. Please make a new PR based on the 6.2-dev branch. Thanks in advance. |
Pull Request resolves # .
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:
onContentPrepare– counts words while article text is raw HTMLonContentAfterTitle– injects the badge intoafterDisplayTitletemplate slotAdmin Configuration:
Testing Instructions
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:
The badge appears automatically in the
afterDisplayTitleposition without requiring template overrides.Notes for Reviewers
Screenshots
Admin Configuration - Words Per Minute Setting

Admin can set the reading speed (default: 50 WPM)
Frontend Display - Reading Time Badge

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