Facebook OG tags Not Working

◇◆丶佛笑我妖孽 提交于 2019-11-29 17:42:11

问题


I have a simple rails 3 app with a FB like button. Ive used FB OG tags to get the image other pertinent info posted during the like transaction.

when i test on my local server and after uploading, lies are posted with Facebook's default image and doesn't include other info from the OG tags.

I looked at few of the other questions on this, reviewed FB's developer instructions on how to use the OG tags and i'm certain I've entered them correctly. Wondering if there's another step or something else that i'm missing

I have the tags in my head section like so

<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>my title</title>
<meta property="og:title" content="My Site" />
<meta property="og:site_name" content="My Site" />
<meta property="og:url" content="http://www.mysite.com/"/>
<meta property="og:image" content="http://www.mysite.com/assets/image.png"/>
<meta property="og:type" content="ecommerce"/>
<%= stylesheet_link_tag "application", :media => "all" %>
<%= favicon_link_tag "/favicon.ico" %>
<%= csrf_meta_tags %>

body stuff


回答1:


Check out this link: http://developers.facebook.com/tools/debug

Input your url or og tag here to get if there is something wrong with your markup.




回答2:


The og:url is the url to the object.

For eg, if your object url is http://yoursite.com/object.php, then the same should be your og:url




回答3:


You should include prefix in html tag:

<html prefix="og: http://ogp.me/ns#">



回答4:


A possible problem would be that your image does not meet the minimum 200px by 200px size. Try to resize your photo to meet these requirements,which actually worked in my case.

Hope this helps.



来源:https://stackoverflow.com/questions/20625565/facebook-og-tags-not-working

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!