I recently updated my Metatag module to the most recent Drupal 7 version. My metatag: [node:field-event-city:locality] used to work. It stopped working after updating my metatag module. Please advise.

Comments

tsmulugeta created an issue. See original summary.

damienmckenna’s picture

Version: 7.x-1.26 » 7.x-1.x-dev
Category: Bug report » Support request

First off, I'm sorry you've ran into this problem.

Metatag isn't responsible for the tokens themselves, do you know what module provides that field? What used the output look like? What does it look like now? Have you tried the latest dev snapshot to see if that solves the problem?

tsmulugeta’s picture

Hi,

So it seems that when I want to get a nested value, it doesn't work. For example [node:field_event_city] works but [node:field-event-city:locality] doesn't.

This is the address field. Locality gives the city (at least that's what it used to give).

tsmulugeta’s picture

Title: Question Mark in Open Graph Token » Nested Values Don't Work in Open Graph Tokens
tsmulugeta’s picture

So any array field like address:city or date:first-value, etc. their metatags don't work for me.

damienmckenna’s picture

Title: Nested Values Don't Work in Open Graph Tokens » Nested values don't work in addressfield tokens
Component: Open Graph » Integration with other module
Priority: Major » Normal

Do you mean the Addressfield module?

Might something else be affecting that content type - do you have any custom implementations of Metatag's hooks, or is the "Token" view mode of that content type customized, are the addressfield settings the same between the different content types? Have you examined the data to ensure the "locality" value is filled in on the example node you're testing?

tsmulugeta’s picture

Yes that module and the issue is for all content types (not just one). Sorry for the confusion about that.

tsmulugeta’s picture

Any nested value has the problem including the Date module

damienmckenna’s picture

Title: Nested values don't work in addressfield tokens » Nested token values don't work correctly

By any chance do you have the Token Tweaks module installed?

tsmulugeta’s picture

No I don't have the module Token Tweaks installed. So the issue is NOT with all nested tokens. The issue seems to be only with fields I have programmatically altered. The metatags used to work but now don't anymore. I updated my metatag module to the dev version thinking that would fix it but it didn't.

tsmulugeta’s picture

I make changes to 2 fields (an address filed and a date field) within the function theme_util_form_node_form_alter

Perhaps this is affecting the metatags for these fields? How can I programmatically set the metatag for those fields if perhaps something I'm doing in theme_util_form_node_form_alter is affecting the metatags?

damienmckenna’s picture

Let's take this up in email..

erwangel’s picture

This seems to be an address_field module issue. Looking at hook_tokens_alter, I realized that my 1.3 version of "address field" didn't generate any tokens anymore ($replacements array was empty) ; it used to work in 1.2. Patch #5 of https://www.drupal.org/project/addressfield/issues/3082673 resolved temporarily my use case. I didn't try the dev version.

damienmckenna’s picture

Status: Active » Postponed (maintainer needs more info)

erwangel: Thank you for spotting that, hopefully it'll help tsmulugeta.

tsmulugeta: Please give the patch in the other issue a try and let us know if it solves the problem for you.

damienmckenna’s picture

Status: Postponed (maintainer needs more info) » Closed (won't fix)

I thank you for your contribution to the Metatag module and the Drupal community as a whole. The D7 version of this module is no longer supported, so I am closing this issue.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.