-
AuthorPosts
-
April 15, 2021 at 10:13 pm #1294624
In the Google Rich Result tests, I see that there is no name set for my FAQPage element (which is created by an accordion in Enfold).
There is no error or warning, but I still would like to set a name for the FAQPage for SEO purposes.
How could I do this?
What would I need to change in my child theme, e.g. to set the name of the FAQPage to the text content of a custom field?- This topic was modified 3 years, 7 months ago by Ismael.
April 19, 2021 at 11:14 am #1295217Hey AlexR,
Thank you for the inquiry.
We can use the following filter in the functions.php file to add the name attribute to the faq schema markup, but it seems not necessary because the tool is not returning any errors.
add_filter('avf_markup_helper_attributes', 'avf_markup_helper_attributes_modified', 10, 2); function avf_markup_helper_attributes_modified($attributes, $args) { if( $args['context'] == 'faq_section' ) { $attributes['name'] = 'FAQ'; } return $attributes; }
Best regards,
IsmaelApril 19, 2021 at 11:37 am #1295225Hi Ismael,
I have added your code and re-run the Google Rich Results Tests, but without success: It still shows “Unnamed item” for the FAQ for the page specified in the Private Content section.
Could you please double check?
Thanks
AlexApril 21, 2021 at 6:36 am #1295687Hi,
Looks like the tool fetch the name from the headline element such h1, h2 or any element with the itemprop=”headline” attribute, or from the title element in the head tag. However, according to the structured data documentation, FAQPage does not require a headline, name or title attribute and it does not provide anyway to do so, same as with Breadcrumb element.
// https://developers.google.com/search/docs/data-types/faqpage#faq-page
You can actually test the example given in the documentation, and it will still return an unnamed entry.
Best regards,
IsmaelApril 21, 2021 at 9:26 am #1295732Hi Ismael,
thank you for this great answer. Seems that the issue is on Google’s side.
Please feel free to close this question.
Thank you
AlexApril 22, 2021 at 12:30 pm #1296025Hi,
No problem. It is possible that not all elements require a name because its type (e.g FAQ, Breadcrumb) already describes the element effectively.
Please do not hesitate to open another thread if you need anything else. We will close this one for now.
Have a nice day.
Best regards,
Ismael -
AuthorPosts
- The topic ‘How can I set the name for a FAQPage (accordion element) in rich snippets?’ is closed to new replies.