我正在整合我的网站上的Facebook共享,并努力让og meta标签正常工作。目前,当我单击共享按钮时,会打开一个对话框,但共享对话框中的信息不是我在元标记中指定的信息。相反,标题是页面标题,没有图像,描述是页面上的一个段落,如下所示:
如何将信息作为元标记中指定的信息?
以下是相关的html:
<head>
<meta property="og:url" content="url" />
<meta property="og:title" content="Dope Clothing" />
<meta property="og:description" content="South African streetwear by South African streetwear lovers" />
<meta property="og:image" content="Images/logo_thumbnail.png" />
</head>
<body>
<div id="fb-root"></div>
<script>
window.fbAsyncInit = function() {
FB.init({
appId : '1471809223084795',
xfbml : true,
version : 'v2.1'
});
};
(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/sdk.js";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
</script>
<div id="share">
<div class="share-box"><div class="facebook-share">f</div></div>
</div>
单击共享按钮时触发的Javascript函数:
$('.facebook-share').click(function() {
FB.ui({
method: 'share',
href: 'http://www.website.com/index.php',
}, function(response){});
});