Facebook share not showing image from open graph metatags

前端 未结 3 2259
北荒
北荒 2021-02-19 11:21

I\'m trying to integrate the Facebook share button to my employer\'s site, the title, url, description/intro are all displaying correctly, however no image is being attached. Wh

相关标签:
3条回答
  • 2021-02-19 11:51

    If everything is OK on the scraped result, try to fetch new scrap information using Facebook Debugger.

    This is because Facebook use its own cache for og:data.

    0 讨论(0)
  • 2021-02-19 11:56

    In my experience :

    • All the URLs should be absolute (even the og:image value)
    • If your image is served equally over https you should add a og:image:secure_url meta property with absolute url as well (if you serve everything only over https you can skip this)
    • Add as well a og:image:width and og:image:height meta properties

    Main url redirection is very tricky, you should make absolutely sure your content is correctly (and fully) fetched, for complex dynamic content I often end up doing a detection in the .htaccess to serve FB’s crawler appropriate content as follow :

    RewriteEngine On
    RewriteCond %{HTTP_USER_AGENT} facebookexternalhit/[0-9]
    RewriteRule ^(.*)$ OG_GENERATOR_SCRIPT_HERE.php [L,QSA]
    
    0 讨论(0)
  • 2021-02-19 12:00

    Without seeing the HTML output from your code, I could only make a guess as to the issue. Don't use a relative url like <%=shortUrl%>, but be sure to use the fully-qualified Url....something that has the http(s):// on it.

    Also, http://developers.facebook.com/docs/share/ says that this share button is being deprecated. Please change over to using the Like button instead: http://developers.facebook.com/docs/reference/plugins/like/

    0 讨论(0)
提交回复
热议问题