Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Facebook Open Graph No Image First Time

I'm trying to configure a share/send button with a link. I've properly configured the open graph image tags on a page, but when opening the share/send dialog for the first time, the image doesn't show. Without refreshing the page, opening the share/send dialog for the second time, the image will show. The URL of the page and the images are all in HTTP (instead of HTTPS).

I can't simply use the URL-Linting tool as the page will have a unique URL. The website is about sending virtual flowers to people and so the page to be shared is freshly generated.

Would really appreciate some help :)

like image 558
Freeman L Avatar asked Jan 13 '15 00:01

Freeman L


People also ask

Why is image not showing in OG?

Right-click on your page and click on View Page Source. Then check if you're able to find the og:image tag added in the source code. If the og:image tag is not found, that means Rank Math is either disabled or not able to print your social tags.

Why is my link image not showing on Facebook?

You might not be seeing the Facebook link preview you want because the info has been cached by Facebook. (Facebook saves the info from URLs and pages that have already been shared, for better performance.) So you just may need to force Facebook to clear the cache. 1.

How do you add an Open Graph to Facebook?

Click on 'Social'. Click on the 'Facebook' tab. Toggle the 'Add Open Graph meta data' switch. To enable the feature, toggle the switch to 'On'.

Does Facebook use Open Graph?

In fact, if Facebook doesn't find the og:title tag on your page, it uses the open graph tag title instead. As Facebook explains, most content is shared as a URL. If you want control over the way your content looks on its site, you must add OGP tags.


2 Answers

Found the problem. Somehow this problem happens if you don't set your open graph tags properly.

Incorrect:

<meta property="og:image" content="http://asdfg.com/<%= videoId %>/image" />

Correct:

<meta property="og:image" content="http://asdfg.com/<%= videoId %>/image" />
<meta property="og:image:secure_url" content="https://asdfg.com/<%= videoId %>/image" /> 
<meta property="og:image:width" content="640" /> 
<meta property="og:image:height" content="442" />
like image 75
Freeman L Avatar answered Oct 17 '22 03:10

Freeman L


UPDATE

This solution with iframe is not working anymore! Worked since yesterday 06 February 2017. Facebook just set X-Frame-Options as DENY so you cannot load the sharer url in an iFrame.


I added og:image:width and og:image:height, checked all my property tags and the problem was still there.

I found a workaround for this facebook bug that worked: I added an hidden iFrame with the sharer link in the page footer; in this way the facebook crawler check the page once is loaded.

<iframe style="width: 0px; height: 0px; margin: 0px; padding: 0px;" src="https://www.facebook.com/sharer/sharer.php?u=http%3A%2F%2Fwww.example.com"></iframe>
like image 3
Dan Avatar answered Oct 17 '22 04:10

Dan