我昨天在一个页面上工作了,现在需求已经改变了,他们希望这个共享功能在感谢页面上,所以我已经将代码移到了新页面,这是meta的一部分这页纸。通过传入的模型动态设置标题和图像,我不相信这会导致问题
@section metas{
<meta property="og:title" content="@Model.YoghurtTitle" />
<meta property="og:description" content="Check out the flavour I have just created!" />
<meta property="og:image" content="http://danone.staging-eurorscg.com.au/Content/FlavourLab/Combinations/@Model.ImageCombination" />
<meta property="og:url" content="http://danone.staging-eurorscg.com.au/thank-you" />
}
这是我目前设置的分享按钮
<div class="col-sm-6">
<div class="row col-lg-12 text-center danoneBlue">
<div class="fb-share-button" data-href="http://danone.staging-eurorscg.com.au/thank-you" data-layout="button"></div>
</div>
</div>
和脚本
<div id="fb-root"></div>
@section scripts{
<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_GB/sdk.js#xfbml=1&version=v2.0";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
</script>
}
当我右键单击页面上的查看源时,这是我在头部分中看到的
<meta property="og:title" content="Check out the flavour I just made! Cool Yoghurt" />
<meta property="og:description" content="Check out the flavour I have just created!" />
<meta property="og:image" content="http://danone.staging-eurorscg.com.au/Content/FlavourLab/Combinations/danone_ultimate_coconut_vanilla.png" />
<meta property="og:url" content="http://danone.staging-eurorscg.com.au/thank-you" />
一切看起来都很正确。然而,当我在以下网址debugger
上运行facebook http://danone.staging-eurorscg.com.au/thank-you时我得到的错误如下:
我不知道它的味道实验室在哪里,是的,该脚本之前已经在该页面上,但它现在已经通过Facebook Developer Plugin Share移动和更新,现在存在于感谢页面上。