I have a site: mysite
and a node: mynode

On the node I'm using open graph with tokens
My open graph title field contains one token: [node:title] | mysite

So the result should look like this:
<meta content="mynode | mysite" property="og:title"></meta>

But the [node:title] token isn't working, so the result is:
<meta content=" | mysite" property="og:title"></meta>

Another tokens are working like [node:id] and [current-page:title]

And the [node:title] also worked with 7.x-1.6

CommentFileSizeAuthor
#3 opengraphtitle.png21.44 KBfanky4

Comments

fanky4 created an issue. See original summary.

damienmckenna’s picture

Category: Bug report » Support request

Please let me know where you're filling in the [node:title] token.

fanky4’s picture

StatusFileSize
new21.44 KB

Thank you for the quick reply!

admin/config/search/metatags/config/mycontenttype
In the Open Graph title field

The attached image is half-hungarian but maybe it helps

damienmckenna’s picture

The node:title token is provided by core, so I'm surprised it isn't working for you.

Do you get any errors when you save the meta tags with [node:title] filled in? If you do then something is changing the available tokens, if you do not then something is changing the title.

Do you have anything installed that might affect the title for nodes, or might there be code in the theme or custom modules that would blank it out for some reason?

fanky4’s picture

I don't get errors after save and also nothing in the log.

Do you have anything installed that might affect the title for nodes

I don't think so. This metatag is not a new feature. It worked well until the 7.x-1.7 update. :\
When I revert the metatag to 7.x-1.6, it's working again.

damienmckenna’s picture

Did you run the db updates and clear caches after updating?

fanky4’s picture

Yes, a couple of times. Even the live, local, and dev site. The problem is still exist

damienmckenna’s picture

Can you please test with the current -dev version, see if the problem persists with it?

jeremylang’s picture

I bumped into this same issue after upgrading to 7.x-1.7 (though not specific to Open Graph). After a little bit of digging, I discovered that this section in metatag.module:

// Include token replacement data. Don't reload the entity object as doing
// so would conflict with content editorial workflows.
if (!empty($entity_id)) {
  $token_type = token_get_entity_mapping('entity', $entity_type);
  $options['token data'][$token_type] = $entity;
}

can be modified to correct the issue. If the entity is reloaded as in version 7.x-1.6:

// Include token replacement data. Don't reload the entity object as doing
// so would conflict with content editorial workflows.
if (!empty($entity_id)) {
  $token_type = token_get_entity_mapping('entity', $entity_type);
  // $options['token data'][$token_type] = $entity;
  $entities = entity_load($entity_type, array($entity_id));
  $options['token data'][$token_type] = $entities[$entity_id];
}

The node tokens render as expected. Printing the $entities and $entity variables out, I see that the 'title' value in the cached $entity is NULL while it is populated in the re-loaded $entities. Not considering that the fix, but seems like there might be something up with the cached value.

Tried the latest dev build but the issues persists.

Additional Information:
My issue is with the Page Title field for the Global Node config in Metatags. Value is [node:title] - [site:name]. [site:name] renders, but [node:title] comes up blank. Using Page Manager's node_view to control the output of the node page.

Have cleared the cache and performed the database updates a few times without errors.

skein’s picture

Hello

I had the same issue and it happened to me because ctools_node_content_content_type_render in CTOOLS specifically removed the title of the node. This is because I used panels and just needed to change the settings to Leave Title.

That solved the issue for me.

damienmckenna’s picture

Version: 7.x-1.7 » 7.x-1.x-dev
Status: Active » Closed (cannot reproduce)

Please confirm that a) you've updated to the latest version of CTools, Token and Metatag, b) if you're using Panels please make sure that the title field in Panels is set to %node:title. If the problem persists, please reopen this issue.