Just this. I need to create some metatag using the metatag module: https://www.drupal.org/project/metatag

Something like:

<meta property="og:locale" content="en_US" />
<meta property="og:type" content="website" />

I can't see how to get this in its setting.

Then after I will need to use these metatags in nodes and views.

1 Answer 1


You can either use Custom Meta module or roll your own module:

From Custom Meta project page:

The module allows you to define and manage custom meta tags. Simply select the Meta attribute (property, name, http-equiv) and set the value and content value in the format and the module will add your meta tags to all non-admin content for your site.

An example of writing your own module:


name = My Metatags  
description = Provides my custom Metatags.  
core = 7.x  
version = 7.x-1.x  
dependencies[] = metatag  
files[] = my_metatags.metatag.inc



 * Implements hook_ctools_plugin_api().
function my_metatags_ctools_plugin_api($owner, $api) {
  if ($owner == 'metatag' && $api == 'metatag') {
    return array('version' => 1);


// Implements hook_metatag_info().
function my_metatags_metatag_info() {
  $info['groups']['my_metatags'] = array(
    'label' => t('My Custom Metatags'),

  $info['tags']['my_custom_metatag'] = array(
    'label' => t('My Custom Meta Tag'),
    'description' => t('This is a custom meta tag'),
    'class' => 'DrupalTextMetaTag',
    'group' => 'my_metatags',

  return $info;

// Implements hook_metatag_config_default_alter().
function my_metatags_metatag_config_default_alter(array &$configs) {
  foreach ($configs as &$config) {
    switch ($config->instance) {
      case 'global':
        $config->config += array();

      case 'global:frontpage':
        $config->config += array();

      case 'node':
        $config->config += array(
          'my_custom_metatag' => array('value' => 'This is a default value.'),

      case 'taxonomy_term':
        $config->config += array();

      case 'user':
        $config->config += array( );

Hope that helps.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.