Hello everyone, welcome back to techbrushup. In this tutorial, we're gonna see how to install and configure the meta tag module so let's get started, the meta tag module allows you to manage your meta tags within Drupal.
Additional info: if you want to learn more about the module just head over to drupal.org .
Download and Install
The most popular way to add the Module through Composer. Because using composer we don't need to care about dependencies as composer downloads it automatically. Go to module page
Download using Composer
composer require drupal/metatag
Install
There are two ways to install the Module using manually or using drush.
Install manually
Once module downloaded go to Extend Search for meta tags and enable it.
OR
Install using Drush Installation link
How to configure metatags
Once the Metatag module has been installed,Click to Configure
link or navigate to /admin/config/search/metatag. You can see default configuration and settings for all content. Before custom configuration lets have a look default configuration first.
default configuration
Global
first one is global anything configured here will be used across the whole site.
Front page
just for the home page we can configure the meta tags differently.
Custom meta tags configuration
Before going into dive lets understand how modules work, The Meta Tag module works hierarchically based means suppose if you want to create meta tag for a particular content type like article, First it will inherit from the default configuration type: content and type: global
As per requirements lets create meta tags for a particular content type and i'll show you how to do that.
Metatag module allows you to kind of override configuration.
Click on Add default meta tags
and select your favourete content Type from dropdown
Basic Tags
Page title
Under Basic tags choose Page title, Click Browse available tokens
link to insert and choose particular tokens [current-page:title] | [site:name]
Description
Under Basic tags Choose Description, Browse available tokens
link to insert and choose particular tokens [node:summary]
Keywords
Under Basic tags Choose Keywords, Browse available tokens
link to insert and choose particular tokens [node:field_tags]
Then click on Save.