Adding Structured Data to COVID-19 Announcements on Drupal 8

Filed under:

Giving back to the Drupal Community
Nick Wilde 1

Nick Dickinson-Wilde

Development Manager for Back-End Drupal
Nick Dickinson-Wilde is a Backend Drupal Development Manager at Taoti Creative currently focused on Drupal 9 and the future. He's west coast Canadian born and raised. Loves karate, biking, games…

In light of the COVID-19 outbreak, Google has introduced two new ways to elevate and highlight your organization’s special announcements on Google Search. Bing also supports the structured metadata method. We can now add SpecialAnnouncement structured data to your web pages to increase the odds important messages appear in Google Search (and Bing) results – provisionally, they will look like the below, although that is still evolving.

To support implementing the update in the most efficient way possible for our clients (many of whom are on Drupal 8), we have developed a Drupal 8 module that implements it in an easily configurable way through the Metatag system. Specifically, this has been implemented as a sub-module within the Metatag module. As firm believers in the value of the Drupal community, we have contributed it back. So that should be in the next release of Metatag. In the meantime, it is ready to use.

Adding Structured Data to COVID-19 Announcements on Drupal 8 2

How to / Usage

Installation is a backend task, but anyone moderately familiar with the Drupal UI can configure it – including clients depending on requirements. After installation (see below), you can set the SpecialAnnouncement schema through the metatag interface – either globally at /admin/config/search/metatag/ or per node if you have that enabled. Right now, there are conflicting opinions on whether it’s best to have the SpecialAnnouncement defined only on a specific page or on all pages. Many are leaning towards all pages for faster indexing and possibly better results, although that is an evolving topic – as everything COVID-19 seems to be.

The UI provides many fields, but the most frequently needed are at the top. Most organizations will only need the top 6 – any non-relevant fields can be left blank with no harm.

Adding Structured Data to COVID-19 Announcements on Drupal 8 3


The simplest way to say it is « Install the schema metatag module as you normally install modules and apply the patch.» This is both highly accurate and not particularly friendly. If you use Composer & Drush, do the following:

  •  add the following to your composer.json
    "drupal/schema_metatag": {
      "SpecialAnnouncement Support": ""
  • run `composer require “drupal/schema_metatag`
  • run `drush en schema_specia_announcement -y`

Drupal 7

But wait, you say, that patch is only available for Drupal 8 and I’m still on Drupal 7. Fear not, it is relatively easy to implement the same with no UI. Copy and paste the following into your active theme’s `html.tpl.php` head section, replacing all CAPITALIZED PHRASES with relevant data.

<script type="application/ld+json">
        "@context": "",
        "@type": "SpecialAnnouncement",
        "name": "COVID 19 ANNOUNCEMENT",
        "text": "SHORT DETAILS",
        "datePosted": "DATE POSTED – EXAMPLE: 2020-04-14",
        "expires": "OPTIONAL:2020-04-24",
        "category": "",

There are many more options – both in the schema and supported by our Drupal 8 UI – but those are the most important and easiest to understand.

We are here to help!

At Taoti, we are here to help, so please let us know how we can assist your organization, especially as we navigate together through these unprecedented times. Drop us a line at!


*Image: COVID-19 SpecialAnnouncement on Google Search, licensed under CC BY 4.0.*