3 This module allows a site's builder to automatically provide structured
4 metadata, aka "meta tags", about the site and individual pages.
6 In the context of search engine optimization, providing an extensive set of
7 meta tags may help improve the site's and pages' rankings, thus may aid with
8 achieving a more prominent display of the content within search engine results.
9 They can also be used to tailor how content is displayed when shared on social
12 For additional information, see the online documentation:
13 https://www.drupal.org/docs/8/modules/metatag
15 This version should work with all Drupal 8 releases, though it is always
16 recommended to keep Drupal core installations up to date.
20 --------------------------------------------------------------------------------
21 Metatag for Drupal 8 requires the following:
24 https://www.drupal.org/project/token
25 Provides a popup browser to see the available tokens for use in meta tag
30 --------------------------------------------------------------------------------
31 The primary features include:
33 * An administration interface to manage default meta tags.
35 * Use of standard fields for entity support, allowing for translation and
36 revisioning of meta tag values added for individual entities.
38 * A large volume of meta tags available, covering commonly used tags, Open
39 Graph tags, Twitter Cards tags, Dublin Core tags, Google+ tags, App Links
40 tags, site verification tags and more; all but the basic meta tags are kept
41 in separate submodules.
43 * The fifteen Dublin Core Basic Element Set 1.1 meta tags may be added by
44 enabling the "Metatag: Dublin Core" submodule.
46 * The Open Graph Protocol meta tags, as used by Facebook, Pinterest, LinkedIn
47 and other sites, may be added by enabling the "Metatag: Open Graph" submodule.
49 * The Twitter Cards meta tags may be added by enabling the "Metatag: Twitter
52 * Certain meta tags used by Google+ may be added by enabling the "Metatag:
55 * Facebook's fb:app_id, fb:admins and fb:pages meta tags may be added by
56 enabling the "Metatag: Facebook" submodule. These are useful for sites which
57 are using Facebook widgets or are building custom integration with Facebook's
58 APIs, but they are not needed by most sites and have no bearing on the
61 * Site verification meta tags can be added, e.g. as used by the Google search
62 engine to confirm ownership of the site; see the "Metatag: Verification"
65 * The Metatag: Mobile & UI Adjustments submodule adds the MobileOptimized,
66 HandheldFriendly, viewport, cleartype, theme-color, format-detection,
67 apple-mobile-web-app-capable, apple-mobile-web-app-status-bar-style, the
68 android-app and ios-app alternative link meta tags, and the Android manifest
71 * The hreflang meta tags are available via the Metatag:hreflang submodule.
73 * The App Links meta tags may be added by enabling the Metatag: App Links
76 * Support for meta tags specific to Google Custom Search Appliance are available
77 in the "Metatag: Google Custom Search Engine (CSE)" submodule.
79 * Meta tags specific to Facebook are included in the "Metatag: Facebook"
82 * A plugin interface allowing for additional meta tags to be easily added via
85 * Integration with DrupalConsole [1] to provide a quick method of generating new
89 Standard usage scenario
90 --------------------------------------------------------------------------------
91 1. Install the module.
92 2. Open admin/config/search/metatag.
93 3. Adjust global and entity defaults. Fill in reasonable default values for any
94 of the meta tags that need to be customized. Tokens may be used to
95 automatically assign values.
96 4. Additional bundle defaults may be added by clicking on "Add metatag
97 defaults" and filling out the form.
98 5. To adjust metatags for a specific entity, the Metatag field must be added
99 first. Follow these steps:
101 5.1 Go to the "Manage fields" of the bundle where the Metatag field is to
103 5.2 Select "Meta tags" from the "Add a new field" selector.
104 5.3 Fill in a label for the field, e.g. "Meta tags", and set an appropriate
105 machine name, e.g. "meta_tags".
106 5.4 Click the "Save and continue" button.
107 5.5 If the site supports multiple languages, and translations have been
108 enabled for this entity, select "Users may translate this field" to use
109 Drupal's translation system.
112 Programmatically assign meta tags to an entity
113 --------------------------------------------------------------------------------
114 There are two ways to assign an entity's meta tags in custom module. Both
115 scenarios require a "Metatag" field be added to the entity's field settings, the
116 field name "field_meta_tags" is used but this is completely arbitrary.
120 $entity_type = 'node';
124 'title' => 'Testing metatag creation',
127 'field_meta_tags' => serialize([
128 'title' => 'Some title',
129 'description' => 'Some description.',
130 'keywords' => 'Some,Keywords',
133 $node = \Drupal::entityTypeManager()->getStorage($entity_type)->create($values);
138 $node = Node::create(array(
144 $node->set('title', 'Testing metatag creation');
145 $node->set('field_meta_tags', serialize([
146 'title' => 'Some title',
147 'description' => 'Some description.',
148 'keywords' => 'Some,Keywords',
152 In both examples, the custom meta tag values will still be merged with the
153 values defined via the global defaults prior to being output - it is not
154 necessary to copy each value to the new record.
157 DrupalConsole integration
158 --------------------------------------------------------------------------------
159 Using the DrupalConsole, it is possible to generate new meta tags, either for
160 use in new custom modules that require custom meta tags, or to create patches
161 for extending Metatag's options.
163 To generate a new tag, install DrupalConsole and then use the following command:
165 drupal generate:plugin:metatag:tag
167 This will guide the site builder through the necessary steps to create a new
168 meta tag plugin and add it to a module.
170 There is also a command for generating meta tag groups:
172 drupal generate:plugin:metatag:group
174 Again, this provides a guided process to create a new group.
178 --------------------------------------------------------------------------------
179 Some modules are available that extend Metatag with additional or complimentary
183 https://www.drupal.org/project/schema_metatag
184 Extensive solution for adding schema.org support to Metatag.
186 * Real-time SEO for Drupal
187 https://www.drupal.org/project/yoast_seo
188 Uses the YoastSEO.js library and service (https://yoast.com/) to provide
189 realtime feedback on the meta tags.
192 https://www.drupal.org/project/metatag_cxense
193 Adds support for the Cxense meta tags used by their DMP and Insight services.
195 * Metatag Google Scholar
196 https://www.drupal.org/project/metatag_google_scholar
197 Adds support for a number of meta tags used with the Google Scholar system.
201 --------------------------------------------------------------------------------
202 * In order to uninstall the module any "Metatag" fields must first be removed
203 from all entities. In order to see whether there are fields blocking the
204 module from being uninstalled, load the module uninstall page
205 (admin/modules/uninstall) and see if any are listed, it will look something
207 The Meta tags field type is used in the following field:
209 In order to uninstall the module, go to the appropriate field settings pages
210 and remove the Metatag field listed in the message. Once this is done it will
211 be possible to uninstall the module.
215 --------------------------------------------------------------------------------
216 Currently maintained by Damien McKenna [2] and Dave Reid [3]. Drupal 7 module
217 originally written by Dave Reid. Early work on Drupal 8 port by Damien McKenna
218 and Michelle Cox [4], and sponsored by Mediacurrent [5]; key improvements by
219 Juampy Novillo Requena [6] with insights from Dave Reid and sponsorship by
220 Lullabot [7] and Acquia [8]. Additional contributions to the 8.x-1.0 release
221 from cilefen [9], Daniel Wehner [10], Jesus Manuel Olivas [11], Lee Rowlands
222 [12], Michael Kandelaars [13], Ivo Van Geertruyen [14], Nikhilesh Gupta B [15],
223 Rakesh James [16], and many others.
225 Ongoing development is sponsored by Mediacurrent.
227 The best way to contact the authors is to submit an issue, be it a support
228 request, a feature request or a bug report, in the project issue queue:
229 https://www.drupal.org/project/issues/metatag
233 --------------------------------------------------------------------------------
234 1: https://www.drupal.org/project/console
235 2: https://www.drupal.org/u/damienmckenna
236 3: https://www.drupal.org/u/dave-reid
237 4: https://www.drupal.org/u/michelle
238 5: https://www.mediacurrent.com/
239 6: https://www.drupal.org/u/juampynr
240 7: https://www.lullabot.com/
241 8: https://www.acquia.com/
242 9: https://www.drupal.org/u/cilefen
243 10: https://www.drupal.org/u/dawehner
244 11: https://www.drupal.org/u/jmolivas
245 12: https://www.drupal.org/u/larowlan
246 13: https://www.drupal.org/u/mikeyk
247 14: https://www.drupal.org/u/mr.baileys
248 15: https://www.drupal.org/u/nikhilesh-gupta
249 16: https://www.drupal.org/u/rakeshgectcr