Credits & Thanks
Thank you to:
- Dave Reid for creating this module
- Damien McKenna
- Jim Birch
- The large number of other contributors to this module!
SEO Training Camp:
Title tags: https://moz.com/learn/seo/title-tag
Meta tags: https://moz.com/blog/the-ultimate-guide-to-seo-meta-tags
Metatag Module: https://www.drupal.org/docs/contributed-modules/metatag
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.
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
- Install the Metatag module on your server. (See this section for more instructions on installing modules.)
- Go to the Extend page: Click Manage > Extend (Coffee: "extend") or visit https://<yourDrupalsite.dev>/admin/modules.
- Select the checkboxes next to:
Metatag: Facebook (optional)
Metatag: Open Graph
Metatag: Twitter Cards (optional)
Schema.org Image Object
NOTE: If there are any other Metatag or Schema.org modules that you feel you might use, include those in this installation as well.
- 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.
- Click Manage > People (Coffee: “people”) and click into the Permissions tab. Or visit https://<yourDrupalsite.dev>/admin/people/permissions.
- Select the appropriate checkbox for Administer Metatag.
- 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.
- 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:
- Click the arrow next to the following Entity types to expand those sections:
- Content: Article
- Content: Basic Page
- Content: Blog (you may need to create this content type first)
- Content: <name of any custom content types>
- Taxonomy term: Tags
- User: User
- 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.)
- For the Content: Article content type, select the check boxes for Basic Tags, Open Graph, Twitter Cards, Schema.org: Article.
- For the Content: Blog content type, select the check boxes for Basic Tags, Open Graph, facebook, Twitter Cards, Schema.org: Article.
- For the User: User type, select the check boxes for Basic Tags, facebook, Twitter Cards, Schema.org: Person.
- 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):
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.