I have installed the Metatag module on a Drupal Commerce site, with the intention to make the OpenGraph metatag of the product image available to Facebook. The idea is that Facebook picks the image of an article based on the metag.
However I don't see what token to use to construct the metatag field 'image'.
An example image URL to the article image is: http://example.com/sites/default/files/styles/scalecrop_450x450/public/a...
In the Metatag settings, I try to add the image metatag to the product display content type.
I can see that this token is available [node:field-product:0:field-images:file] But if I append that to the URL http://example.com/sites/default/files/styles/scalecrop_450x450/public/ ..then Facebook does not pick it up. I use the Sharing Debugger of Facebook to test it, and clear the cache and scrape each time.
How to construct the URL that should go in the OpenGraph metatag 'image' ?
Comment | File | Size | Author |
---|
Comments
Comment #2
DamienMcKennaTry using just "[node:field-product:0:field-images]" and see how it works.
Comment #3
Yuri CreditAttribution: Yuri commentedI tried [node:field-product:0:field-images] but that is not working.
It appears that Metatag just does not recognize tokens at all? I see that this is an issue often posted.
The Metatag module shows the following in admin/config/search/metatags#
Comment #4
DamienMcKenna@Yuri: Yes, Metatag supports tokens, to say otherwise is just silly. Metatag does not control the token browser, that's the Token module's responsibility. Nested tokens are a little fiddly to deal with, I'll see if I can get some time soon to test it out.
Comment #5
GuyPaddock CreditAttribution: GuyPaddock at RedBottle Design, LLC for Inveniem commented@DamienMcKenna: Tokens support for product images does, indeed, seem broken.
Using this token
[node:field-product:0:field-product-image]
(we're using a different field name for the product images), this is what the markup looks like:Comment #6
GuyPaddock CreditAttribution: GuyPaddock at RedBottle Design, LLC for Inveniem commentedOkay, so... this variant seems to work:
[node:field-product:0:field_product_image]
Note the underscores instead of the hyphens. As always, the usability of the Token module is at an all-time high.
Comment #7
MikeiLL CreditAttribution: MikeiLL commentedI'm relatively new to Drupal and have been struggling with this issue for a couple of hours now.
Using Drupal 7 and Metatag 7.x-1.22.
I have added a Default Meta Tag: Content Product.
I have tried putting tokens as well as url strings into:
I have tried the following nodes and "available tokens":
The following tags are being generated, but I cannot seem to get the "og:image" tag to generate.
What on earth am I missing?
Comment #8
DamienMcKenna@MikeiLL: What is the name of the field that you want to use? What type of field is it?
Comment #9
MikeiLL CreditAttribution: MikeiLL commented@DamienMcKenna Thank you so much for getting back to me.
I am not sure what type of field it is: a "Product Image"? It gets added via an Image, File Upload form at `example.com/node/843`.
The images display in `example.com/sites/default/files/`. It resides in an HTML block that looks like this:
Does that help? I'm used to Wordpress, but with Drupal very much in the dark. Not sure how one can actually "inspect" nodes.
Comment #10
DamienMcKenna@MikeiLL: Go to the content types admin list (admin/structure/types), click on the "manage fields" link for the content type you're working on, find the "machine name" for the image field and let us know what it is.
As for inspecting nodes, you can use the Devel module to give you a "Devel" tab on the node page that gives you a nested array display of the node's values. But I don't think you need that right now.
Comment #11
MikeiLL CreditAttribution: MikeiLL commentedProduct (Machine name: product)
Use products to represent items for sale on the website, including all the unique information that can be attributed to a specific model number.
Comment #12
DamienMcKenna@MikeiLL: Oh, I see. Are you using Commerce Kickstart v2?
Comment #13
MikeiLL CreditAttribution: MikeiLL commentedCommerce is actually installed, but disabled. We are using Ubercart (as far as I can tell).
Comment #14
DamienMcKennaOk, that would change how the tokens would be used.
Because this issue is focused on Commerce, I opened another issue for working with Ubercart: #3031096: Tokens for Ubercart product images
Let's move over to the other issue.