Code Metal
Code Metal

Reputation: 602

Facebook: meta og:image not work

i used this meta for my website

<meta property="og:image" content="http://tongkienphi.com/public/uploads/2013/3/702594ed31541de6fc7ab4ba488bc14f_thumb.jpg"/>

But, when i post one link to facebook, it's not detect that image, it's always detect banner image :(

Upvotes: 11

Views: 29088

Answers (2)

Derzu
Derzu

Reputation: 7146

I tried many solutions from many different questions about this thread. Nothing worked.

Quotes Required

Whatsapp Android just reads correctly the og:image attribute if it is between quotes. It's probably a bug.

My index.html was with double quotes, but when I build it for production (npm run build) the quotes are removed by the Minify module.

To avoid quotes removal just set the removeAttributeQuotes attribute to false.

minify: {
    ...
    removeAttributeQuotes: false,
    ...
}

In my development environment, I set it on the "webpack.prod.conf.js" file. Set it at your equivalent file.

Now, just rebuild it and upload to the server.

Problem solved. Just use the quotes at the head meta og attributes and the sharing image will be shown.

Upvotes: 0

Robert Owen
Robert Owen

Reputation: 930

Check that facebook has not already cached the header image before you added meta data.

Put your URL into this site and facebook will help you out:

http://developers.facebook.com/tools/debug

Upvotes: 34

Related Questions