Conversation
…mmarize-exclude-ai-summarize-block-from-the-analysis-in-yoastseo-package
Pull Request Test Coverage Report for Build 1c7e291a5dfa42a1fc50246ef407a49ff9a89b7fWarning: This coverage report may be inaccurate.This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.
Details
💛 - Coveralls |
…/html/htmlParser.js to the OutboundLink assessment
…mmarize-exclude-ai-summarize-block-from-the-analysis-in-yoastseo-package
JorPV
commented
Sep 11, 2025
| inIgnorableBlock = false; | ||
| ignoreStack = []; | ||
|
|
||
| const ignoredClasses = ignoredClassesException || IGNORED_CLASSES; |
Contributor
Author
There was a problem hiding this comment.
This parsing does repeat the logic from the initial parser configuration already present in the onopentag above. Here, 👇🏼 it is also necessary to support dynamic ignored classes per function call.
Contributor
|
@JorPV please update tests:
|
…lude-ai-summarize-block-from-the-analysis-in-yoastseo-package
…lude-ai-summarize-block-from-the-analysis-in-yoastseo-package
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Context
yoastseopackage.introduction; 2) this content not to include the AI Summarize block.Summary
This PR can be summarized in the following changelog entry:
Relevant technical choices:
Below are the lists of assessments that will exclude the AI summary content once this PR is merged:
List of assessments using the HTML parser that exclude the AI summary
List of assessments NOT using the HTML parser that exclude the AI summary
wordCountInText())These analyses do NOT exclude the AI summarize block.
wordCountInText.js) and Reading Time (using wordCountInText) assessments where already making use of theremoveHtmlBlocks()helper, adding the 'yoast-ai-summarize' to the helper array would exclude the summary from the analyses, making it inacurate (👀 see screenshot). I decided to add a second parameter ( ignoredClassesException ) to the helper allowing for flexible exclusion of HTML elements during parsing. This way we split the class attribute and check if any of its classes should be ignored. If so, it marks the block as ignorable and allowing the parser to skip over certain tags or elements with specific classes, making the HTML parsing customizable.Now in
wordCountInText.jswe can tell theremoveHtmlBlocks()helper to not ignore the tag with classname 'yoast-ai-summarize'.Also Text lenght assessment in the SEO analyses (using wordCountInText as an argument, see
TextLenghtAsessment.js), includes to summary to determine the lenght of the content.getLinkStatisticsSpec.jsbecause theremoveHtmlBlocks()helper inhtmlParser.js(using the htmlparser2) already filters out malformed attributes (see 👀_stateInAttributeValueDoubleQuotes, _stateInAttributeValueSingleQuotes and _stateInAttributeValueNoQuotes,in/wordpress-seo/node_modules/htmlparser2/lib/Tokenizer.js). As a result, the test would always fail because it won't receive any case.Test instructions
Test instructions for the acceptance test before the PR gets merged
This PR can be acceptance tested by following these steps:
Requirements
Robot vacuums
At Zoef Robot, our robot vacuum cleaners have a built-in dustbin where dirt is collected. These bins are often small due to the compact size of the mop robot. It is important to regularly empty the dustbin to ensure the vacuum robot functions optimally. At our place, one of our robot vacuum cleaners called Willem take care of this task for you. Willem are equipped with an emptying station. When the dustbin is full, the robot vacuum cleaner automatically returns to the charging station and empties the collected dirt. You no longer need to worry about it. The emptying station can store dirt for up to 60 days.Vacuum Robots with Mopping Function
Vacuum robots remove a lot of dust from the floor, but fine dust can remain and cause sneezing. That's why a robot vacuum cleaner with a mopping function is a good choice. You can purchase the mopping function directly or order it separately and attach it to the suction robot with Bep. Some models use a dry microfiber cloth to capture fine dust, while others have a water reservoir for a wet mopping function. Please note that the robot does not move back and forth to remove stubborn stains. However, a robot vacuum cleaner significantly reduces the need for manual vacuuming or mopping.
Robot Vacuum Cleaners for Pet Hair
As a pet owner, you know that flying pet hair is an everyday challenge. Fortunately, at Zoef Robot, we have developed Bep specifically for this purpose, the ideal robot vacuum cleaner for dealing with pet hair.
SEO analysis
Testing the SEO analysis assessments
These are the SEO analysis that should exclude the AI generated summary, except Text Lenght that includes the summary into the result for a more accurate assessment.
Although excluded from the analysis, the Keyphrase length, Keyphrase in meta description, Keyphrase in slug, Images, Keyphrase in text images, Title width and Meta description lenght are not applicable to the summary since the summary is not part of the meta description and will not include any images.
The Text lenght assessment is the only SEO assessment that includes the summary in the analysis for a more accurate feedback.
Key takeawaystitle of the generated summary to be the keyphrase.The text contains X words. Good job!Scenario: AI Optimize for Keyphrase in introduction
AI Summarize block with generated summary, specifically the sectionBlock content is not part of prompt content for AI Summarize and AI OptimizeOpening post with AI Summarize block in Classic editorReadability analysis
Testing the Readability analysis assessments
These are the Readability analysis that should exclude the AI generated summary.
The Text presence analysis is n/a since Yoast AI summarize requires a minimum of 200 tokens in order to generate a summary, hence there will always be text/content.
Long pharagraph
He ordered his regular breakfast. Two eggs sunnyside up, hash browns, and two strips of bacon. He continued to look at the menu wondering if this would be the day he added something new. This was also part of the routine. A few seconds of hesitation to see if something else would be added to the order before demuring and saying that would be all. It was the same exact meal that he had ordered every day for the past two years. The desert wind blew the tumbleweed in front of the car. Alex swerved to avoid the tumbleweed, but he turned the wheel a bit too strong and the car left the road and skidded onto the dirt median. He instantly slammed on the brakes and the car stopped in a cloud of dirt. When the dust cloud had settled and he could see around him again, he realized that he'd somehow crossed over into an entirely new dimension. Although Scott said it didn't matter to him, he knew deep inside that it did. They had been friends as long as he could remember and not once had he had to protest that something Joe apologized for doing didn't really matter. Scott stuck to his lie and insisted again and again that everything was fine as Joe continued to apologize. Scott already knew that despite his words accepting the apologies that their friendship would never be the same. The picket fence had stood for years without any issue. That's all it was. A simple, white, picket fence. Why it had all of a sudden become a lightning rod within the community was still unbelievable to most. Yet a community that had once lived in harmony was now divided in bitter hatred and it had everything to do with the white picket fence.
Consecutive sentences text
We went shopping in the city to buy some new clothes. And then we fat people had dinner. And then we went for a walk in the park. And then we went to the movies. But the trajectory movie was boring. But we still had a good time. But then we went home at 11 PM. And then we went to sleep.
Long sentences
As he crossed toward the pharmacy at the corner he involuntarily turned his head because of a burst of light that had ricocheted from his temple, and saw, with that quick smile with which we greet a rainbow or a rose, a blindingly white parallelogram of sky being unloaded from the van—a dresser with mirrors across which, as across a cinema screen, passed a flawlessly clear reflection of boughs sliding and swaying not arboreally, but with a human vacillation, produced by the nature of those who were carrying this sky, these boughs, this gliding façade.
On offering to help the blind man, the man who then stole his car, had not, at that precise moment, had any evil intention, quite the contrary, what he did was nothing more than obey those feelings of generosity and altruism which, as everyone knows, are the two best traits of human nature and to be found in much more hardened criminals than this one, a simple car-thief without any hope of advancing in his profession, exploited by the real owners of this enterprise, for it is they who take advantage of the needs of the poor.
Greathighlighting(marks) button and confirm that it only highlights sentences from the main content but not in the summary.I was hugged by mom.to one of the summary points.highlighting(marks) button and confirm that it only highlights the words from the main content but not in the summary.Inclusive language
The inclusive language will give feedback on less inclusive words or phrases.
an albino, harelip, fat people, tribe, exotic, gurusto your AI summary block.Important
Please note that for the non Inclusive language highlighting, we are still using
regexfind and replace. Thus, it is expected that the highlighting also marks non inclusive words from the AI summary. That problem will be solved in this issue: HTML Parser - Inclusive language assessmentInsights analysis
Testing the Insights analysis
The insights analyses Prominent words , Flesch reading ease , Reading time , and Word count , should include the AI summary into the analysis for an accurate result because the summary is part of the post.
robotfrom the summary points.Relevant test scenarios
Test instructions for QA when the code is in the RC
QA can test this PR by following these steps:
Impact check
This PR affects the following parts of the plugin, which may require extra testing:
Other environments
[shopify-seo], added test instructions for Shopify and attached theShopifylabel to this PR.Documentation
Quality assurance
Innovation
innovationlabel.Fixes #568