I am finding the Metatag module rather unwieldy, and I want to create fields in the content type from which Metatag values will be set.

Are there tokens available for the fields of any arbitrary content type, that can be used, or a set formula for creating them?

  • After some web searches and viewing the content on admin/help/token I can see a list of tokens under Node. I have put one in a metatag field and it appears to have worked. I will do some more testing to see if that will be good enough
    – vfclists
    Aug 20, 2018 at 20:49

1 Answer 1


You try use hook_tokens()

 * Implements hook_tokens().
function mymodule_tokens($type, $tokens, array $data = array(), array $options = array()) {
  $replacements = array();
  if ($type == 'key_token' && !empty($data['node'])) {
    $node = $data['node'];
    foreach ($tokens as $name => $original) {
  return $replacements;

See more document hook_tokens()

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.