{"id":57189,"date":"2023-04-27T20:47:56","date_gmt":"2023-04-27T15:17:56","guid":{"rendered":"https:\/\/www.tothenew.com\/blog\/?p=57189"},"modified":"2023-05-02T21:24:16","modified_gmt":"2023-05-02T15:54:16","slug":"a-guide-to-configure-metatag-module-in-your-drupal-website","status":"publish","type":"post","link":"https:\/\/www.tothenew.com\/blog\/a-guide-to-configure-metatag-module-in-your-drupal-website\/","title":{"rendered":"A guide to configure metatag module in your Drupal website"},"content":{"rendered":"<p>Meta tags are the extract of the page\u2019s content. These HTML tags play a pivotal role in search engine optimization. They do not appear on the page but definitely do on the page&#8217;s source code. Drupal provides a metatag module (https:\/\/www.drupal.org\/project\/metatag) to generate meta keywords for your Drupal website. It can be done at the global level, content type level, and node level.<\/p>\n<h3><strong>Installing the meta tag module:-<\/strong><\/h3>\n<p>1. <span style=\"font-weight: 400;\">Install the module using composer.<br \/>\n<img decoding=\"async\" loading=\"lazy\" class=\"alignleft size-full wp-image-57080\" src=\"\/blog\/wp-ttn-blog\/uploads\/2023\/04\/Screenshot-from-2023-04-12-12-17-50.png\" alt=\"\" width=\"409\" height=\"40\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2023\/04\/Screenshot-from-2023-04-12-12-17-50.png 409w, \/blog\/wp-ttn-blog\/uploads\/2023\/04\/Screenshot-from-2023-04-12-12-17-50-300x29.png 300w\" sizes=\"(max-width: 409px) 100vw, 409px\" \/><br \/>\n<\/span><\/p>\n<p>2. <span style=\"font-weight: 400;\">Enable the module using the drush command.<br \/>\n<img decoding=\"async\" loading=\"lazy\" class=\"alignleft size-full wp-image-57081\" src=\"\/blog\/wp-ttn-blog\/uploads\/2023\/04\/Screenshot-from-2023-04-12-12-30-59.png\" alt=\"\" width=\"409\" height=\"40\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2023\/04\/Screenshot-from-2023-04-12-12-30-59.png 409w, \/blog\/wp-ttn-blog\/uploads\/2023\/04\/Screenshot-from-2023-04-12-12-30-59-300x29.png 300w\" sizes=\"(max-width: 409px) 100vw, 409px\" \/><br \/>\n<\/span><\/p>\n<p>3. <span style=\"font-weight: 400;\">After the successful installation of the meta tag module, go to the configuration page (\/admin\/config\/search\/metatag) of the metatag module where you can spot the configurations for content types, default error pages, etc.<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignleft wp-image-57082\" src=\"\/blog\/wp-ttn-blog\/uploads\/2023\/04\/Screenshot-from-2023-04-12-12-36-39.png\" alt=\"\" width=\"690\" height=\"371\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2023\/04\/Screenshot-from-2023-04-12-12-36-39.png 1235w, \/blog\/wp-ttn-blog\/uploads\/2023\/04\/Screenshot-from-2023-04-12-12-36-39-300x161.png 300w, \/blog\/wp-ttn-blog\/uploads\/2023\/04\/Screenshot-from-2023-04-12-12-36-39-1024x550.png 1024w, \/blog\/wp-ttn-blog\/uploads\/2023\/04\/Screenshot-from-2023-04-12-12-36-39-768x412.png 768w, \/blog\/wp-ttn-blog\/uploads\/2023\/04\/Screenshot-from-2023-04-12-12-36-39-624x335.png 624w\" sizes=\"(max-width: 690px) 100vw, 690px\" \/><br \/>\n<\/span><\/p>\n<h2><b><br \/>\nConfiguring meta tags for a content type:-<\/b><\/h2>\n<p>1. <span style=\"font-weight: 400;\">\u00a0On the meta tag configuration page, first click on \u201cadd default meta tags&#8221;. Then you can find the content types listed on your website in the type dropdown. Select the content type of your choice. In our case, we have chosen the &#8220;basic page&#8221; content type.<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignleft wp-image-57083\" src=\"\/blog\/wp-ttn-blog\/uploads\/2023\/04\/Screenshot-from-2023-04-12-12-58-05.png\" alt=\"\" width=\"617\" height=\"331\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2023\/04\/Screenshot-from-2023-04-12-12-58-05.png 1235w, \/blog\/wp-ttn-blog\/uploads\/2023\/04\/Screenshot-from-2023-04-12-12-58-05-300x161.png 300w, \/blog\/wp-ttn-blog\/uploads\/2023\/04\/Screenshot-from-2023-04-12-12-58-05-1024x550.png 1024w, \/blog\/wp-ttn-blog\/uploads\/2023\/04\/Screenshot-from-2023-04-12-12-58-05-768x412.png 768w, \/blog\/wp-ttn-blog\/uploads\/2023\/04\/Screenshot-from-2023-04-12-12-58-05-624x335.png 624w\" sizes=\"(max-width: 617px) 100vw, 617px\" \/><br \/>\n<\/span><\/p>\n<p><span style=\"font-weight: 400;\">2. After saving, you can find another field set for your selected content type (i.e. basic page)<br \/>\n<img decoding=\"async\" loading=\"lazy\" class=\"alignleft size-full wp-image-57084\" src=\"\/blog\/wp-ttn-blog\/uploads\/2023\/04\/Screenshot-from-2023-04-12-13-09-51.png\" alt=\"\" width=\"1242\" height=\"311\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2023\/04\/Screenshot-from-2023-04-12-13-09-51.png 1242w, \/blog\/wp-ttn-blog\/uploads\/2023\/04\/Screenshot-from-2023-04-12-13-09-51-300x75.png 300w, \/blog\/wp-ttn-blog\/uploads\/2023\/04\/Screenshot-from-2023-04-12-13-09-51-1024x256.png 1024w, \/blog\/wp-ttn-blog\/uploads\/2023\/04\/Screenshot-from-2023-04-12-13-09-51-768x192.png 768w, \/blog\/wp-ttn-blog\/uploads\/2023\/04\/Screenshot-from-2023-04-12-13-09-51-624x156.png 624w\" sizes=\"(max-width: 1242px) 100vw, 1242px\" \/><br \/>\n<\/span><\/p>\n<p>3. Edit your desired content type&#8217;s metatag, then click &#8220;browse available token&#8221;. You can find multiple tokens available, but we need to choose from &#8220;nodes&#8221; for content types.<br \/>\n<img decoding=\"async\" loading=\"lazy\" class=\"alignleft wp-image-57085\" src=\"\/blog\/wp-ttn-blog\/uploads\/2023\/04\/Screenshot-from-2023-04-12-13-24-48.png\" alt=\"\" width=\"685\" height=\"151\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2023\/04\/Screenshot-from-2023-04-12-13-24-48.png 1255w, \/blog\/wp-ttn-blog\/uploads\/2023\/04\/Screenshot-from-2023-04-12-13-24-48-300x66.png 300w, \/blog\/wp-ttn-blog\/uploads\/2023\/04\/Screenshot-from-2023-04-12-13-24-48-1024x225.png 1024w, \/blog\/wp-ttn-blog\/uploads\/2023\/04\/Screenshot-from-2023-04-12-13-24-48-768x169.png 768w, \/blog\/wp-ttn-blog\/uploads\/2023\/04\/Screenshot-from-2023-04-12-13-24-48-624x137.png 624w\" sizes=\"(max-width: 685px) 100vw, 685px\" \/><\/p>\n<p>4. From the tokens available for nodes, fill in the fields as per your choice.<br \/>\n<img decoding=\"async\" loading=\"lazy\" class=\"alignleft wp-image-57087\" src=\"\/blog\/wp-ttn-blog\/uploads\/2023\/04\/Screenshot-from-2023-04-12-15-05-00.png\" alt=\"\" width=\"675\" height=\"314\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2023\/04\/Screenshot-from-2023-04-12-15-05-00.png 1211w, \/blog\/wp-ttn-blog\/uploads\/2023\/04\/Screenshot-from-2023-04-12-15-05-00-300x139.png 300w, \/blog\/wp-ttn-blog\/uploads\/2023\/04\/Screenshot-from-2023-04-12-15-05-00-1024x476.png 1024w, \/blog\/wp-ttn-blog\/uploads\/2023\/04\/Screenshot-from-2023-04-12-15-05-00-768x357.png 768w, \/blog\/wp-ttn-blog\/uploads\/2023\/04\/Screenshot-from-2023-04-12-15-05-00-624x290.png 624w\" sizes=\"(max-width: 675px) 100vw, 675px\" \/><\/p>\n<p>5. <span style=\"font-weight: 400;\">To validate this, create\/edit a node of the configured content type. Go to that particular node and inspect the source code; you can find the meta tags you have configured are already prefilled.<\/span><\/p>\n<h3><b>Overriding meta tags for specific nodes:-<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">In the above example, we have configured meta tags for a content type that covers all its nodes. But what if you require meta tags on a node per basis? Well, there is a solution for it. <\/span><span style=\"font-weight: 400;\">To do this, you have to add a meta tag field to your desired content type, as shown in the screenshot below:-<br \/>\n<img decoding=\"async\" loading=\"lazy\" class=\"alignleft wp-image-57177\" src=\"\/blog\/wp-ttn-blog\/uploads\/2023\/04\/Screenshot-from-2023-04-24-12-02-53.png\" alt=\"\" width=\"694\" height=\"205\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2023\/04\/Screenshot-from-2023-04-24-12-02-53.png 1246w, \/blog\/wp-ttn-blog\/uploads\/2023\/04\/Screenshot-from-2023-04-24-12-02-53-300x89.png 300w, \/blog\/wp-ttn-blog\/uploads\/2023\/04\/Screenshot-from-2023-04-24-12-02-53-1024x302.png 1024w, \/blog\/wp-ttn-blog\/uploads\/2023\/04\/Screenshot-from-2023-04-24-12-02-53-768x227.png 768w, \/blog\/wp-ttn-blog\/uploads\/2023\/04\/Screenshot-from-2023-04-24-12-02-53-624x184.png 624w\" sizes=\"(max-width: 694px) 100vw, 694px\" \/><br \/>\n<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Edit any node of that particular content type, and you will notice that a new meta tag field is added to the right sidebar of the page. You can override the meta tags for this node here.<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignleft wp-image-57178\" src=\"\/blog\/wp-ttn-blog\/uploads\/2023\/04\/Screenshot-from-2023-04-24-12-07-59.png\" alt=\"\" width=\"677\" height=\"307\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2023\/04\/Screenshot-from-2023-04-24-12-07-59.png 1263w, \/blog\/wp-ttn-blog\/uploads\/2023\/04\/Screenshot-from-2023-04-24-12-07-59-300x136.png 300w, \/blog\/wp-ttn-blog\/uploads\/2023\/04\/Screenshot-from-2023-04-24-12-07-59-1024x464.png 1024w, \/blog\/wp-ttn-blog\/uploads\/2023\/04\/Screenshot-from-2023-04-24-12-07-59-768x348.png 768w, \/blog\/wp-ttn-blog\/uploads\/2023\/04\/Screenshot-from-2023-04-24-12-07-59-624x283.png 624w\" sizes=\"(max-width: 677px) 100vw, 677px\" \/><br \/>\n<\/span><\/p>\n<h3><b>Configuring the meta tag for views:-<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">1. Enable the meta tag view module(a sub-module of metatag) using drush.<br \/>\n<img decoding=\"async\" loading=\"lazy\" class=\"alignleft size-full wp-image-57180\" src=\"\/blog\/wp-ttn-blog\/uploads\/2023\/04\/Screenshot-from-2023-04-24-12-12-29.png\" alt=\"\" width=\"357\" height=\"24\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2023\/04\/Screenshot-from-2023-04-24-12-12-29.png 357w, \/blog\/wp-ttn-blog\/uploads\/2023\/04\/Screenshot-from-2023-04-24-12-12-29-300x20.png 300w\" sizes=\"(max-width: 357px) 100vw, 357px\" \/><\/p>\n<p><\/span><\/p>\n<p>2. <span style=\"font-weight: 400;\">Edit any view as per your requirement. In our case, we have opted for &#8220;\/blogs&#8221; view. After clicking on edit, you can find a new page setting with the name \u201cmeta tags\u201d.<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignleft size-full wp-image-57183\" src=\"\/blog\/wp-ttn-blog\/uploads\/2023\/04\/Screenshot-from-2023-04-24-12-18-21.png\" alt=\"\" width=\"372\" height=\"236\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2023\/04\/Screenshot-from-2023-04-24-12-18-21.png 372w, \/blog\/wp-ttn-blog\/uploads\/2023\/04\/Screenshot-from-2023-04-24-12-18-21-300x190.png 300w\" sizes=\"(max-width: 372px) 100vw, 372px\" \/><br \/>\n<\/span><\/p>\n<p>3. <span style=\"font-weight: 400;\">Click on this page setting and configure the meta tags for this view page.<br \/>\n<img decoding=\"async\" loading=\"lazy\" class=\"alignleft wp-image-57184\" src=\"\/blog\/wp-ttn-blog\/uploads\/2023\/04\/Screenshot-from-2023-04-24-12-20-24.png\" alt=\"\" width=\"671\" height=\"407\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2023\/04\/Screenshot-from-2023-04-24-12-20-24.png 1084w, \/blog\/wp-ttn-blog\/uploads\/2023\/04\/Screenshot-from-2023-04-24-12-20-24-300x182.png 300w, \/blog\/wp-ttn-blog\/uploads\/2023\/04\/Screenshot-from-2023-04-24-12-20-24-1024x622.png 1024w, \/blog\/wp-ttn-blog\/uploads\/2023\/04\/Screenshot-from-2023-04-24-12-20-24-768x466.png 768w, \/blog\/wp-ttn-blog\/uploads\/2023\/04\/Screenshot-from-2023-04-24-12-20-24-624x379.png 624w\" sizes=\"(max-width: 671px) 100vw, 671px\" \/><br \/>\n<\/span><\/p>\n<p>4. To validate this, click on the &#8220;view page source&#8221; of the output page of that particular content type and you can find the configured metatags.<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignleft size-full wp-image-57185\" src=\"\/blog\/wp-ttn-blog\/uploads\/2023\/04\/Screenshot-from-2023-04-24-12-22-38.png\" alt=\"\" width=\"680\" height=\"184\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2023\/04\/Screenshot-from-2023-04-24-12-22-38.png 680w, \/blog\/wp-ttn-blog\/uploads\/2023\/04\/Screenshot-from-2023-04-24-12-22-38-300x81.png 300w, \/blog\/wp-ttn-blog\/uploads\/2023\/04\/Screenshot-from-2023-04-24-12-22-38-624x169.png 624w\" sizes=\"(max-width: 680px) 100vw, 680px\" \/><\/p>\n<h3>Few highly sub-modules of meta tags are open graphs and Twitter cards. Their implementation can be found below.<\/h3>\n<h3><b>\u00a0Configuring Open graph meta tags for Facebook using metatags:-<\/b><\/h3>\n<p>1. <span style=\"font-weight: 400;\">Enable the \u201cMetatag: Open Graph\u201d module using the drush command as shown below.<br \/>\n<img decoding=\"async\" loading=\"lazy\" class=\"alignleft size-full wp-image-57186\" src=\"\/blog\/wp-ttn-blog\/uploads\/2023\/04\/Screenshot-from-2023-04-24-12-34-08.png\" alt=\"\" width=\"338\" height=\"32\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2023\/04\/Screenshot-from-2023-04-24-12-34-08.png 338w, \/blog\/wp-ttn-blog\/uploads\/2023\/04\/Screenshot-from-2023-04-24-12-34-08-300x28.png 300w\" sizes=\"(max-width: 338px) 100vw, 338px\" \/><br \/>\n<\/span><\/p>\n<p>2. <span style=\"font-weight: 400;\">Edit the \u201ccontent:blog\u201d (choose content type as per your requirement) present on the metatag\u2019s configuration page.<\/span> <span style=\"font-weight: 400;\">Click on \u201cOpen Graph\u201d and configure the tokens available in \u201cbrowse available token\u2019s node section\u201d.<br \/>\n<img decoding=\"async\" loading=\"lazy\" class=\"alignleft wp-image-57187\" src=\"\/blog\/wp-ttn-blog\/uploads\/2023\/04\/Screenshot-from-2023-04-24-12-41-00.png\" alt=\"\" width=\"659\" height=\"391\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2023\/04\/Screenshot-from-2023-04-24-12-41-00.png 995w, \/blog\/wp-ttn-blog\/uploads\/2023\/04\/Screenshot-from-2023-04-24-12-41-00-300x178.png 300w, \/blog\/wp-ttn-blog\/uploads\/2023\/04\/Screenshot-from-2023-04-24-12-41-00-768x456.png 768w, \/blog\/wp-ttn-blog\/uploads\/2023\/04\/Screenshot-from-2023-04-24-12-41-00-624x371.png 624w\" sizes=\"(max-width: 659px) 100vw, 659px\" \/><br \/>\n<\/span><\/p>\n<p><span style=\"font-weight: 400;\">The most commonly used tokens are stated below:-<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Content type: desired_CT<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Page URL: <\/span><span style=\"font-weight: 400;\">[node:url]<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Title: <\/span><span style=\"font-weight: 400;\">[node:title]<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Description: <\/span><span style=\"font-weight: 400;\">[node:summary]<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Image URL<\/span><\/li>\n<\/ul>\n<p>3. <span style=\"font-weight: 400;\">To test it, paste the URL in Facebook sharing debugger tool (<\/span><a href=\"https:\/\/developers.facebook.com\/tools\/debug\/\"><span style=\"font-weight: 400;\">https:\/\/developers.facebook.com\/tools\/debug\/<\/span><\/a><span style=\"font-weight: 400;\">) . The output should look as shown below:<br \/>\n<img decoding=\"async\" loading=\"lazy\" class=\"alignleft size-full wp-image-57188\" src=\"\/blog\/wp-ttn-blog\/uploads\/2023\/04\/Screenshot-from-2023-04-24-12-50-34.png\" alt=\"\" width=\"869\" height=\"391\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2023\/04\/Screenshot-from-2023-04-24-12-50-34.png 869w, \/blog\/wp-ttn-blog\/uploads\/2023\/04\/Screenshot-from-2023-04-24-12-50-34-300x135.png 300w, \/blog\/wp-ttn-blog\/uploads\/2023\/04\/Screenshot-from-2023-04-24-12-50-34-768x346.png 768w, \/blog\/wp-ttn-blog\/uploads\/2023\/04\/Screenshot-from-2023-04-24-12-50-34-624x281.png 624w\" sizes=\"(max-width: 869px) 100vw, 869px\" \/><br \/>\n<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Twitter cards are used to add minimal information, i.e. photos, description, titles, about content of your link. The way you have configured open graph meta tags, you can also configure metatag for Twitter by enabling the metatag:twitter cards sub-module and configuring the desired metatags.<\/span><\/p>\n<div class=\"ap-custom-wrapper\"><\/div><!--ap-custom-wrapper-->","protected":false},"excerpt":{"rendered":"<p>Meta tags are the extract of the page\u2019s content. These HTML tags play a pivotal role in search engine optimization. They do not appear on the page but definitely do on the page&#8217;s source code. Drupal provides a metatag module (https:\/\/www.drupal.org\/project\/metatag) to generate meta keywords for your Drupal website. It can be done at the [&hellip;]<\/p>\n","protected":false},"author":1533,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"iawp_total_views":84},"categories":[3602],"tags":[5195],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/57189"}],"collection":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/users\/1533"}],"replies":[{"embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/comments?post=57189"}],"version-history":[{"count":2,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/57189\/revisions"}],"predecessor-version":[{"id":57313,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/57189\/revisions\/57313"}],"wp:attachment":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/media?parent=57189"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/categories?post=57189"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/tags?post=57189"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}