Search code examples
drupal-7facebook-opengraphmeta-tags

Facebook choosing same image in multiple og:image tag


I have read the following:

Facebook multiple og:image tags - Which is Default?

Facebook sharer.php, how to have multiple og:image tags?

When multiple og:image tags are present the choosing order is speculated as follows:

  • Last image is the one selected
  • Image with the most resolution is selected

Problem

A Drupal site that shares articles that sometimes have main images in the body. In the same page there are other images that are not related to the article but to relative content (they are thumbnails of other articles). I don't want Facebook to pick those images up, so I set a default share image that portrays the logo of the site, in case the article has no main image.

Tags in head are as follows:

<meta property="og:image" content="/sites/default/files/article_main_image.jpg">
<meta property="og:image" content="/sites/default/files/SITE_DEFAULT_image.jpg">

Up until last friday (August 4th 2017) it was working perfect. If the article had an image then it shared the intended image, if it didn't then it shared the default image with the site's logo on it.

Then came Saturday...and low and behold, all the auto shares in Facebook only show the default site image. Facebook is completely ignoring the article's main image. I have no idea why.

Things I have tried (to no avail)

  • Change order of og:image tag so that main article is last one always
  • Change size of default image to be lowest possible, 200x200 pixels (original order of apperance)
  • Change size of default image to be lowest possible and make it appear first so that main article image is last

I have no idea what else to do to make it work again. Worst of all I don't know how to explain why it is no longer working. It's driving me nuts.


Solution

  • I finally figured out what was happening. For the field in Drupal I did not have a single value, but rather a comma separated list of values, because the image could come from different fields.

    Turns out that when the fields described in the input were empty or had no value, the site's domain was printed out. I figure Facebook saw the home link and took whatever image they wanted from it.

    Solution?

    Only have the image value in that field, period.