How to leverage structured data
Adding structured data can enable search results that are more engaging to users and might encourage them to interact more with your website
The distribution (as of version 10.3.0) leverages the community contributed Schema.org metatag module and custom code to integrate structured data into many content types. You can test if your page is outputting structured data by using the Schema.org Validator or Google’s Rich Results Test
Once your site is updated, structured data will be automatically generated 🎉 with no additional work from content editors.
Articles
The Article (Layout Builder) content type implements the Article Schema as per Google’s Article structured data docs.
Articles have three options for the Type, which map to their appropriate Schema:
- Blog → BlogPosting
- News → NewsArticle
- Press Release → Article (there is currently no other appropriate Schema)
Customizing Articles
This mapping is set in code (y_lb_article_metatags_alter
in
y_lb_article.module), but all other settings are configurable via the Metatag configuration (/admin/config/search/metatag/node__article_lb
).
Branches
The Branch content type implements the LocalBusiness Schema as per Google’s Local business structured data docs.
Any time the Branch Hours are updated, that content will also be reflected in the Structured Data that’s read by search engines.
Customizing Branches
The mapping is configurable in the Metatag configuration (/admin/config/search/metatag/node__branch
). Hours configuration uses the
Open Y Hours_metatag tokens.
FAQs
The Accordion Layout Builder Block has an option to implement the FAQPage Schema as per Google’s FAQ structured data docs.
If an Accordion section contains Frequently Asked Questions, check the FAQ? checkbox to output them as structured data.
Tips for writing good FAQ content:
- Ensure the content contains individual sets of questions (“How old does my child need to be to swim at the YMCA?”) and answers (“The YMCA offers swim classes starting at age 3 and the pool is open to children of all ages with parental supervision”).
- Only one FAQ should be added to a page. If more than one is added, only the first will be output to the structured data.
Customizing FAQs
Due to the complexity of the FAQ data, the structured data is managed entirely in code and is not customizable via the Drupal admin. If you need specific customizations, please post your ideas in Slack or suggest them on the Roadmap for the core team to discuss and implement.
Other Metatags
The distribution also includes metadata configuration for each content type, which can be found in the Metatag configuration (/admin/config/search/metatag
).
Homepage Metatag Overrides
On some sites, the homepage may have unique metadata requirements. The homepage metatags can be overridden in the “Front page” metatag configuration.
For sites that use Layout Builder, it may be necessary to disable the Front Page metatag settings so that the Landing Page (Layout Builder) tags can be used instead.
- Go to
/admin/config/search/metatag/front
- Scroll to the bottom of the form.
- Uncheck Active and Save the settings.
Once you have changed the settings, check the metadata of the homepage with a tool like Social Share Preview to ensure the correct data is being output.