How Structured Content Help You Getting Noticed in the Search Results

| | 2 min read

Making your content readable by search engines is always a win-win situation: You get a chance to get your content highlighted by the search engine and in return, search engines can save a bit of energy and computing power in extracting the meaning of your content.

Here is how we leverage structured data markup on our Drupal website and get rewarded by Google 🙂

FAQ Markup Rendered by Google

This is the end result we got, Google picked up the FAQ Schema implemented in a specific page.

Drupal is well known for its data modelling capability. We use that to create the FAQ content type.

FAQ Content Type In Drupal

The display mode feature (View modes) in Drupal allow us to render a content in different ways.

By default, the FAQ page will render as follows

FAQ page full view

We want to insert the FAQs in a landing page and want to render it differently. Entity reference comes handy in these scenarios. We have created an entity reference field in the landing page content type and selected the option to render the field as a rendered entity with the view mode we want.

Here is how the entity reference looks like. The autocompletion makes it easy to pick the FAQ you want to insert into the landing page.

FAQ entity reference

Here is how the FAQ renders on the landing page.

FAQ content type rendered in a landing page

To get the schema for the FAQ working, a bit of coding required, it was pretty straight forward, use hook_metatags_attachments_alter(): and get the entity from the reference field, render it as FAQ schema and push it to the $attachments array.

Here is the rendered FAQ schema

FAQ Schema

Now it is testing time. For that I use the Rich Results Test by Google
Here is the result

FAQ Schema test results

There is an option to preview the results (simulate the results) to see how it will look in a real scenario.

FAQ Schema Preview

It took a few days for Google to show the FAQ in the real search results. This entire exercise did not take more than half a day to complete. Now, if I want to extend the article content type to include and render FAQ, it is a matter of adding the FAQ reference field and updating the article view modes where the FAQ needs to be rendered. See the power of Drupal!!!