The Metatag Module

expert metatag module install and config

https://www.drupal.org/project/metatag

Credits & Thanks

Thank you to:

 

About the Metatag module

The Drupal Metatag module allows you to set up Drupal to dynamically provide title tags and structured metadata, aka meta tags, on each page of your site.

what meta tags look like in web code

Giving you control over your HTML title tag is the most important thing that the Metatag module does for SEO. That all-important tag is critical to your search engine ranking.

Note: It may be confusing that the Title Tag functionality resides within the Metatag module, but it makes sense from a technical standpoint. Both the HTML title tag and meta tags are placed in the header of a web page. By handling them both in the Metatag module, it requires less code and enables (slightly) faster rendering of your web pages.

Besides handling the title tag, the Metatag module programmatically creates meta tags for your website. Meta tags are snippets of text that tell a search engine about your pages. Meta tags help your SEO by communicating clearly to the search engine and social networks what each page on your website is about and how you want them to describe it in the search results. If you don’t do this, you will have to rely on the search engines to identify and classify your content. While they’re kind of good at this, it’s important enough that you don’t want to leave it to chance.

Install and Enable the Metatag Module

  1. Install the Metatag module on your server. (See this section for more instructions on installing modules.)
     
  2. Go to the Extend page: Click Manage > Extend (Coffee: "extend") or visit https://<yourDrupalsite.dev>/admin/modules.
     
  3. Select the checkboxes next to:

      Metatag
      Metatag: Facebook (optional)
      Metatag: Open Graph
      Metatag: Twitter Cards (optional)
      Metatag: Verification
      Schema.org Article
      Schema.org Image Object
      Schema.org Metatag
      Schema.org Organization
      Schema.org Person
      Schema.org Webpage
      Schema.org Website

    NOTE: If there are any other Metatag or Schema.org modules that you feel you might use, include those in this installation as well.
     
  4. Click the Install button at the bottom of the page. You may get a message asking for your permission to install the Token module. If you do, click the Continue button.

If necessary, give yourself permissions to use the Metatag module.

  1. Click Manage > People (Coffee: “people”) and click into the Permissions tab. Or visit https://<yourDrupalsite.dev>/admin/people/permissions.
     
  2. Select the appropriate checkbox for Administer Metatag.
     
  3. Click the Save permissions button at the bottom of the page.

Select Meta Tags Types for Content

Before setting the specific default Meta Tags for each content type, you will want to make sure that only the meta tags needed for each entity type are enabled.

  1. Click Manage > Configuration > Search and metadata > Metatag > Settings (Coffee: "metatag") or visit https://<yourDrupalsite.dev>/admin/config/search/metatag/settings in your browser. This will take you to the Configure the Metatag module page:
     Configure the Metatag Module page
     
  2. Click the arrow next to the following Entity types to expand those sections:
    1. Content: Article
    2. Content: Basic Page
    3. Content: Blog (you may need to create this content type first)
    4. Content: <name of any custom content types>
    5. Taxonomy term: Tags
    6. User: User
       
  3. Under each, you should see a section that looks like this:


    If you leave them blank, all types will show up in the default metatag configuration pages and within the content edit forms, if you've added the meta tags to display there. (For more information on making sure your custom content types have the Meta tags fields available to edit within each page, go here.)
     
  4. For the Content: Article content type, select the check boxes for Basic Tags, Open Graph, Twitter Cards, Schema.org: Article.
     
  5. For the Content: Blog content type, select the check boxes for Basic Tags, Open Graph, facebook, Twitter Cards, Schema.org: Article.
     
  6. For the User: User type, select the check boxes for Basic Tags, facebook, Twitter Cards, Schema.org: Person.
     
  7. Click the Save configuration button at the bottom of the page.

Set Meta Tags for Your Site

Each Drupal site will have their own unique content types. Some sites only use the default content types that come with a basic Drupal installation. Others can have many custom content types based upon the need of the organization and the website.

However, you don't always need to set up default meta tags for all content types, especially if you are setting up default tags globally. As explained on the Metatag module configuration page:

"Meta tag patterns are passed down from one level to the next unless they are overridden...If the top-level configuration is not specific enough, additional default meta tag configurations can be added for a specific entity type or entity bundle, e.g. for a specific content type.

"Meta tags can be further refined on a per-entity basis, e.g. for individual nodes, by adding the "Metatag" field to that entity type through its normal field settings pages."

This is the order in which Meta Tags are inherited within the module (this is not an exhaustive list, just an example):

Drupal metatag inheritance chart

 

So if you want a meta tag to appear on every page, make sure it's within the Global defaults; if only on content pages, make sure it's in the Content defaults; if only on a single type of content page, only add it to that content type defaults. Sometimes you need to make changes on specific pages, so make sure you have meta tags available within your content edit pages.

The Metatag module takes advantage of the tokens within the Drupal website. Because they can differ from Drupal website to Drupal website, we recommend familiarizing yourself with those for each Drupal website you work on.

You should be able to find a list of the tokens available for your website by going to https://<yourDrupalsite.dev>/admin/help/token. If the developers have turned that off on the back end, you may need to have them re-enable it so you can get access. Otherwise, you may need to rely on your developers' help to figure out what they are.

To get an idea of how to use tokens within your meta tags, here is a basic list of Content tags, but you will want to check on the architecture of your website and that the tokens are correct:

Basic Tags > Page title [node:title] | [site:name]   
Basic Tags > Description    [node:summary]
Basic Tags > Abstract [node:field_metatags:description]


Because the Metatag module is so important, and there are many nuances to configuration, you will want to spend some time working through them all and deciding the best configuration and finding the appropriate tokens for your website.

 

Need help with your Drupal Metatags or SEO?
Contact Volacci and we'll set up a no-obligation consultation.