1

I have implemented the custom meta tag module found here: http://www.phase2technology.com/blog/creating-custom-meta-tags-with-the-metatag-module/

The following code creates my new meta tag, the problem is that it creates a

<meta name="my_custom_metatag"> 

tag.

How can I make it print out a

<meta property="my_custom_metatag">

tag instead?

<?php
//
// 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;
}

Thanks!

1 Answer 1

0

Telling your custom meta tag to use the property theme formatter should do the trick.

$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',
  'element' => array(
    '#theme' => 'metatag_property',
  ),
);
0

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.