The <meta> tag is one of the secret tools for a better SERP. Despite the fact that, today, there are new and improved tools available, Meta tag still remains a popular choice. In the tutorial, we will learn quick and simple approach to add metadata with the Drupal metatag module.
Already popular as an SEO-friendly CMS, in Drupal 8, the Metatag module is bundled with a number of sub-modules which help boost SERP.
The Metatag module allows you to automatically provide structured metadata of a webpage. Often it is used interchangeably with meta description and meta keywords of a page. Other than this, the module supports Open Graph Protocol for Facebook, Twitter Cards for Twitter, allowing control over the presentation of the content on social networks.
The module also provides APIs so content creators can set the content of a page's meta tags by themselves.
How to use Metatag Module on a custom page in Drupal 8?
Download and install the metatag module from Drupal.org. Or copy the link for version 8.
Go to Admin > Extend > Add New Module > Paste the link > Click Install.
Adjust global and entity defaults as per your needs. Fill in reasonable default values for any of the meta tags that need to be customized. Tokens may be used to automatically assign values, so install it simultaneously.
Additional bundle defaults may be added by clicking on "Add metatag defaults" and filling out the form.
Add the field to the desired node and click on Manage fields.
Select meta tags and Save and Continue.
Select "Meta tags" from "Add a new field".
And... you are done!
Some of the features include...
A large volume of meta tags covering commonly used tags such as Open Graph tags, Twitter Cards tags, Dublin Core tags, Google+ tags, App Links tags, site verification tags are available. All but the basic meta tags are kept in separate submodules.
An administration interface to manage default meta tags.
Use of standard fields for entity support, allowing for translation and revisioning of meta tag values added for individual entities.
Certain meta tags used by Google+ may be added by enabling the "Metatag: Google+" submodule.
The Metatag: Mobile & UI Adjustments submodule adds the MobileOptimized, HandheldFriendly, viewport, cleartype, theme-color, format-detection, apple-mobile-web-app-capable, apple-mobile-web-app-status-bar-style, the android-app and ios-app alternative link meta tags, and the Android manifest tag.
The hreflang meta tags are available via the Metatag: hreflang submodule.
The App Links meta tags may be added by enabling the Metatag: App Links submodule.
Support for meta tags specific to Google Custom Search Appliance are available in the "Metatag: Google Custom Search Engine (CSE)" submodule.
Meta tags specific to Facebook are included in the "Metatag: Facebook" submodule.
A plugin interface allowing for additional meta tags to be easily added via custom modules.
Easy integration with DrupalConsole to provide a quick method of generating new meta tags.
On the concluding note, meta tags are easy to export and save in feature modules for easier deployment since Metatag uses standard Drupal tokens for building the contents of its tags. By using DrupalConsole, it is possible to create custom Meta Tags to be used in custom modules.
Let us know in the comments below how you found the article.
Mohit is an Opensource enthusiast and loves to learn and spend time exploring Drupal and currently working on Drupal 8.
He loves to hang out with his friends other than traveling. Being a tech lover, he is always into chomping the latest gadgets.He plans to continue his lure for Drupal 8.