Conversation
Adds FAQPage structured data for pages built from shiro/accordion blocks. The blocks are static, so there is no render callback to hook; instead an FAQPage node is appended to Yoast's schema @graph via the wpseo_schema_graph filter, reading the saved question/answer markup with DOMDocument (sourced block attributes such as the accordion-item title are not available to parse_blocks() server-side). Gated on the presence of a shiro/accordion block, so it follows the content wherever editors add accordions. Google retired FAQ rich results in 2023, so this serves GEO / AI-citation structured data rather than a search rich snippet. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Collaborator
Author
|
blocked by #372 |
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.
What
Adds FAQPage structured data for pages built from
shiro/accordionblocks (Wikimedia #1231, the SEO/GEO schema gap). Verified there is no first-party FAQPage/JSON-LD emitter today.The accordion blocks are static (markup saved into post content, no render callback), so this appends an
FAQPagenode to Yoast's existing schema@graphvia thewpseo_schema_graphfilter — no separate JSON-LD island. Questions/answers are read from the saved markup withDOMDocument(mirroringinc/editor/blocks/toc.php), because sourced block attributes like the accordion-itemtitleare not available toparse_blocks()server-side.shiro/accordionblock (has_block), so it follows the content wherever editors add accordions — no hardcoded URL list.nameis plain text (any<strong>in the title is stripped); answer HTML (<p>/<ul>) is preserved inacceptedAnswer.text.Files
inc/editor/blocks/accordion.php— new, the schema builder.functions.php— require + bootstrap the new file (existing manual lists).Not in this PR
undefinedCSS-class fix (Task 2) is split out: it changessave()output and touches JS, which is currently blocked by the ESLint 9 flat-config breakage (Wikimedia-900: Delegate header generation to security plugin when present #127). Tracked separately.Note for the ticket
Google retired FAQ rich results in 2023, so this pays off as GEO / AI-citation structured data, not a Search Console rich snippet — acceptance shouldn't be graded on a rich result that will never appear.
Testing
php -lclean;phpcs(repo ruleset) clean on the new file.DOMDocument): 2 Q/A extracted from representative accordion markup,<strong>stripped from the question,<p>/<ul>preserved in the answer, and no-accordion / empty inputs yield nothing.Refs #1231.