Reputation: 3707
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:
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)
og:image
tag so that main article is last one alwaysI 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.
Upvotes: 1
Views: 857
Reputation: 3707
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.
Upvotes: 1
Reputation: 469
Based on my knowledge, when there are multiple og:image
tags, Facebook picks the image with better resolution.
Look at below answer for details.
https://stackoverflow.com/a/12726245/3086531
I guess, in your case, Your site's default image has higher resolution than your article image.
One workaround you can try, is to use a php function to populate meta tags and add them to header. You can have all your logic inside it.
Upvotes: 0