Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set priority order to Open Graph images for links that are inserted in comments. (Not sharing or wall posts.)

When pasting a link to a page within a comment, not directly as a wall post, Facebook defaults to choosing a thumbnail image, without users being able to choose the relevant thumbnail. Is it possible to set or determine priority for og:image tags on pages with multiple og:image tags? There doesn't seem to be any logical way to determine why FB is choosing any specific image. The image they are choosing isn't the first, or last image, by code order or alphabetized by name, and doesn't really follow any reasonable reason that I can figure out. Does anyone know how to set which image is chosen on comments?

I already know how to do this for wall posts, status updates, and sharing links, but you do not have the thumbnail chooser when posting links within comments, so being able to prioritize the order of multiple images would be ideal.

like image 851
qcole Avatar asked Dec 03 '11 03:12

qcole


2 Answers

I have just found out that Facebook will try to display best images (higher resolution) first. For example, if I have 3 meta tags in following order:

<meta content='http://mysite/low-res.jpg' property='og:image'>
<meta content='http://mysite/med-res.jpg' property='og:image'>
<meta content='http://mysite/hi-res.jpg'  property='og:image'>

then the order of displaying on Facebook dialog will be:

hi-res.jpg
med-res.jpg
low-res.jpg

I hope it will help.

like image 120
Anh Nguyen Avatar answered Oct 02 '22 16:10

Anh Nguyen


Actually, my experience is that the last tag (farthest down in the header) is given preference. On some of my sites I force the default by manually adding an og:image tag just before the tag.

like image 30
unifiedac Avatar answered Oct 02 '22 17:10

unifiedac