Html Facebook OG 标签不起作用
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/20625565/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Facebook OG tags Not Working
提问by Renegade
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.
我有一个简单的 rails 3 应用程序,带有一个类似 FB 的按钮。我已经使用 FB OG 标签来获取在类似交易期间发布的其他相关信息的图像。
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.
当我在本地服务器上测试并上传后,谎言会与 Facebook 的默认图像一起发布,并且不包含来自 OG 标签的其他信息。
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
我查看了其他一些关于此的问题,查看了 FB 的开发人员关于如何使用 OG 标签的说明,我确定我已经正确输入了它们。想知道是否还有其他步骤或我遗漏的其他东西
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
身体的东西
回答by Ranveer
Check out this link: http://developers.facebook.com/tools/debug
查看此链接:http: //developers.facebook.com/tools/debug
Input your url or ogtag here to get if there is something wrong with your markup.
在此处输入您的 url 或og标签以了解您的标记是否有问题。
回答by Sahil Mittal
The og:urlis the url to the object.
该OG:网址是网址的对象。
For eg, if your object url is http://yoursite.com/object.php, then the same should be your og:url
例如,如果您的对象 url 是http://yoursite.com/object.php,那么您的og:url应该也是如此
回答by Mike Gordo
You should include prefix in html tag:
您应该在 html 标签中包含前缀:
<html prefix="og: http://ogp.me/ns#">
回答by Giannis Brandt
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.
一个可能的问题是您的图像不符合 200 像素 x 200 像素的最小尺寸。尝试调整照片大小以满足这些要求,这在我的案例中确实有效。
Hope this helps.
希望这可以帮助。