Facebook OG标签无法识别

时间:2016-09-30 09:37:57

标签: javascript jquery facebook jsp facebook-graph-api

我在我的基础jsp中有这个。这包含在所有页面中

<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta property="fb:app_id" content="" />
<meta property="og:url" content="" />
<meta property="og:type" content="website" />
<meta property="og:title" content="" />
<meta property="og:description" content="" />
<meta property="og:image" content="" />

我正在尝试使用jquery / js替换此元标记的值,我有这段代码。

$("meta[property='og\\:title']").attr("content", ogTitle);
$("meta[property='og\\:description']").attr("content", ogDescription);
$("meta[property='og\\:image']").attr("content", ogImage);
$("meta[property='og\\:url']").attr("content", link.href);
$("meta[property='fb\\:app_id']").attr("content", appId);

当我调试它时,它会显示正确的详细信息并获得正确的值。

<meta property="fb:app_id" content="xxxxxxxxxxxxxxxx">
<meta property="og:url" content="my_app_url">
<meta property="og:type" content="website">

等...它获得了正确的价值,但是当我尝试分享它时。它只在Facebook上显示我的网址。我试过用这个。 Facebook dev tools debug sharing

并显示此错误:

“即使可以从其他标签推断出值,也应明确提供'og:image'属性。”

“检查网络服务器是否正在运行,并且没有防火墙阻止Facebook的抓取工具。”

“'og:type'属性是必需的,但不存在。”

“应该明确提供'og:url'属性,即使可以从其他标记中推断出值。”

“应明确提供'fb:app_id'属性,指定应用ID,以便将分享给Facebook的故事正确归因于该应用。或者,当打开共享对话框时,可以在url中设置app_id。”< / p>

看到这个错误很奇怪,因为我知道我已经拥有了这些值。有什么想法吗?

我真的看不到或者不知道答案来自哪一方,当你使用类似网址时,这是一个问题,194.23.21.49 / ProjectName / Project ???这是一个新的情况还是这不影响任何?我真的无法理解这个问题,因为我在html中看到了正确的值,但没有转换为facebook的分享。

0 个答案:

没有答案
相关问题