Hi Charlie,
I am not sure if I have stumbled across a couple of bugs with the Accordion element’s FAQ schema output, when testing today. Below is a description and solution from Claude. I hope it makes sense and possibly helps.
Thanks,
Christopher
Bug Report: Cornerstone Accordion FAQ Schema Issues
Product: Cornerstone Page Builder
Component: Accordion Element - FAQ Schema Generation
File: cornerstone/includes/elements/definitions/accordion.php
Function: x_element_render_accordion_faq_schema() (approx. line 192)
Issue Summary
The Accordion element’s FAQ schema generation has two issues that cause validation errors in Google’s Rich Results Test:
Issue 1: Missing @id Property
Problem: The generated FAQPage schema lacks an @id property, which is recommended by Schema.org and helps search engines uniquely identify the FAQ content.
Current Code (line ~192):
php
$faq_schema['@context'] = 'https://schema.org';
$faq_schema['@type'] = 'FAQPage';
$faq_schema['mainEntity'] = [];
Suggested Fix:
php
$faq_schema['@context'] = 'https://schema.org';
$faq_schema['@type'] = 'FAQPage';
$faq_schema['@id'] = get_permalink() . '#faqpage';
$faq_schema['mainEntity'] = [];
Issue 2: Missing name Property
Problem: The FAQPage schema lacks a name property, causing Google Rich Results Test to report “Unnamed item” warnings. While optional according to Schema.org, this property significantly improves schema quality and helps search engines understand the content context.
Suggested Fix:
php
$faq_schema['@context'] = 'https://schema.org';
$faq_schema['@type'] = 'FAQPage';
$faq_schema['@id'] = get_permalink() . '#faqpage';
$faq_schema['name'] = get_the_title() . ' - Frequently Asked Questions';
$faq_schema['mainEntity'] = [];
Issue 3: HTML Content in FAQ Answers (Minor)
Problem: When accordion content includes HTML formatting from Cornerstone’s dynamic content system, the schema includes wrapper <div> elements with inline styles (e.g., <div style="--tco-dcd3-25:;" class="x-text x-content..."> ). Google’s validator expects plain text in the acceptedAnswer.text field.
Current Behavior:
json
"text": "<div style=\"--tco-dcd3-25:;\" class=\"x-text x-content e471-e22-v7\">Answer text here</div>"
Expected Behavior:
json
"text": "Answer text here"
Suggested Fix:
Strip HTML tags from the answer text before adding to schema:
php
$question = [
'@type' => 'Question',
'name' => $itemContent['question'],
'acceptedAnswer' => [
'@type' => 'Answer',
'text' => wp_strip_all_tags($itemContent['answer']), // Add wp_strip_all_tags()
],
];
Reproduction Steps
- Create an Accordion element in Cornerstone
- Enable “FAQ Schema” toggle in accordion settings
- Add accordion items with questions and formatted content
- Publish page and test URL at https://search.google.com/test/rich-results
Expected Result
FAQPage schema should:
- Include
@idproperty with unique identifier - Include
nameproperty describing the FAQ content - Contain clean plain text in
acceptedAnswer.text(no HTML tags) - Pass Google Rich Results Test without warnings
Actual Result
- Missing
@idcauses schema to lack unique identifier - Missing
namecauses “Unnamed item” warning in validation - HTML wrapper tags appear in answer text causing validation issues
Impact
- Google Rich Results Test reports validation warnings
- Search engines may not properly index or display FAQ rich results
- Reduces effectiveness of FAQ schema for SEO