-
Notifications
You must be signed in to change notification settings - Fork 3.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature]: Add captureTDH for Automated TDH Structure Validation to Enhance SEO #34325
Comments
Would |
@yury-s In my scenario, However, I have not yet fully verified whether it can check detailed nesting. There is another reason for proposing |
Feel free to file separate bug/feature request if something is not working in
What would the test verify if you don't know expected text values ahead of time? If you just want to match the structure of the document ignoring actual text, you can write |
@yury-s Test ResultsI tested it using the following markup: <main>
<h1>h1 text</h1>
<section>
<h2>h2 text</h2>
<h3>h3 text</h3>
</section>
{/* <section> */}
<h2>h2 text</h2>
<div>
<h3>h3 text</h3>
<h4>h4 text</h4>
</div>
{/* </section> */}
<h2>h2 text</h2>
</main> And the output from - main:
- heading "h1 text" [level=1]
- heading "h2 text" [level=2]
- heading "h3 text" [level=3]
- heading "h2 text" [level=2]
- heading "h3 text" [level=3]
- heading "h4 text" [level=4]
- heading "h2 text" [level=2] From an ARIA perspective, it correctly recognizes the heading levels. Why Is the Detailed Hierarchy of Heading Tags Necessary?Even if it’s not an issue from an accessibility standpoint, properly structured heading tags are often considered important for SEO because they help search engines understand the content hierarchy of the page. Revisiting the Need for a “captureTDH (tdhSnapshot)” FeatureThe If you’re open to considering such a feature, I’d be happy to prepare a draft PR or a proof of concept. I’d greatly appreciate your thoughts or any concerns you might have. Thank you!
Here is the way I envision it, which I assume is the same way as
|
I'd recommend using a user-land solution and publishing it as a library. This goes outside of the scope for Playwright. |
Thank you for your comments! I understand that this feature can't be incorporated into Playwright. It's a bit disappointing, but I appreciate both of you taking the time to address this issue despite being busy. In the future, I would like to create and publish my own library. |
🚀 Feature Request
Feature Name:
captureTDH
FunctionThe proposed
captureTDH
function captures the structure of Title, Description, and Heading (hereafter referred to as TDH) essential for SEO. It enables automatic verification through a CI pipeline to ensure that these structures are not inadvertently disrupted. This feature effectively detects and prevents issues related to the hierarchical structure of Heading tags, which are common when using component-based frameworks (e.g., React).captureTDH
Functiontarget-page-name-TDH.ts
). If there is a mismatch, the test fails.toMatchTDH
MatcherExample
Test File Example
Verification File Example
Motivation
captureTDH
feature into Playwright enables continuous monitoring and maintenance of SEO and accessibility quality.The text was updated successfully, but these errors were encountered: