我正在尝试在我的产品页面上实现Facebook的OpenGRaph协议.
在每个页面上,我在头部上方有这个:
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:og="http://ogp.me/ns#" xmlns:fb="http://www.facebook.com/2008/fbml">
Run Code Online (Sandbox Code Playgroud)
然后在头部区域我有:
<meta property="og:title" content="This Page Title"/>
<meta property="og:type" content="product"/>
<meta property="og:url" content="http://www.mywebaddress.com"/>
<meta property="og:image" content="http://www.myimage.jpg"/>
<meta property="og:site_name" content="My Site Name"/>
<meta property="fb:admins" content="10101010101"/>
<meta property="og:email" content="hello@mywebaddress.com"/>
<meta property="og:description" content="Description of my product."/>
Run Code Online (Sandbox Code Playgroud)
然后,我有一个带有此代码的"喜欢"按钮:
<script>(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) {return;}
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/en_US/all.js#xfbml=1";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
<div class="fb-like" data-href="http://thispagesurl" data-send="true" data-width="350" data-show-faces="false"></div>
Run Code Online (Sandbox Code Playgroud)
在我看来,一切似乎都复制了可以在Facebook开发者页面上找到的东西,但是当我喜欢'时,Facebook似乎只是在页面标题和一般信息上.
我试图使用他们的对象调试器"调试"页面,我得到这些警告:
Inferred Property The og:url property …Run Code Online (Sandbox Code Playgroud) 可能重复:
在对象调试器中获取错误的ogtype
我有一个与FB开放图集成的网站.我定义了我的对象和操作,现在如果我在facebook调试器中调试我的页面,我会收到警告:
推断属性:应显式提供'og:url'属性,即使可以从其他标记推断出值.
推断属性:应显式提供'og:title'属性,即使可以从其他标记推断出值.
推断属性:应明确提供'og:description'属性,即使可以从其他标记推断出值.
推断属性:应显式提供"og:image"属性,即使可以从其他标记推断出值.
我已经找到了关于这个问题的大量帖子,但我仍然没有得到如何解决它.在该页面上,我在标题中有以下元标记:
<meta content='' name='fb:appid'>
<meta content="test" name='og:description'>
<meta content="test" name='og:title'>
<meta content='...' name='og:url'>
<meta content='...' name='og:image'>
Run Code Online (Sandbox Code Playgroud)
有人可以帮忙吗?