Facebook 对象调试器:属性“og:url”无法解析为类型“url”

发布于 2024-12-29 19:06:37 字数 1424 浏览 1 评论 0原文

当我通过对象调试器运行 Facebook Open Graph 对象 (http://www.21dads.com/testobject) 时,出现以下错误:

对象无效值:URL“http://www.21dads.com/testobject”处的对象 'thetestasdf:recipie' 类型无效,因为给定值 无法解析属性“og:url”的“www.21dads.com/testobject” 作为类型“url”。

缺少必需的属性:og:url 属性是必需的,但不是 存在。

缺少必需的属性:og:type 属性是必需的,但不是 存在。

缺少必需的属性:og:title 属性是必需的,但不是 存在。

以下是对象页面上的 HTML:

<html xmlns="http://www.w3.org/1999/xhtml">

    <head prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns/fb# thetestasdf: http://ogp.me/ns/fb/thetestasdf#">
      <meta property="fb:app_id"      content="325291980834949" />
      <meta property="og:type"        content="thetestasdf:recipie" />
      <meta property="og:url"         content="www.21dads.com/testobject" />
      <meta property="og:title"       content="Cookie Recipie!" />
      <meta property="og:description" content="Tastiest recipe ever" />
      <meta property="og:image"       content="http://cdn.techpatio.com/wp-content/uploads/2009/11/cookie_law_eu.gif" />
      <title> Cookie Recipie</title>
    <head/>

    <body>
        <p> Test object page </p>
    </body>

</html>

URL“www.21dads.com/testobject”是我的控制器,它然后从视图文件生成 HTML。为什么这个网址无法解析?

当其他“缺少必需的属性”错误已经包含在内时,为什么我会收到这些错误?

谢谢。

When I run my Facebook Open Graph object (http://www.21dads.com/testobject) through the Object Debugger, I'm getting the following errors:

Object Invalid Value: Object at URL 'http://www.21dads.com/testobject'
of type 'thetestasdf:recipie' is invalid because the given value
'www.21dads.com/testobject' for property 'og:url' could not be parsed
as type 'url'.

Missing Required Property: The og:url property is required, but not
present.

Missing Required Property: The og:type property is required, but not
present.

Missing Required Property: The og:title property is required, but not
present.

Here is the HTML on the object page:

<html xmlns="http://www.w3.org/1999/xhtml">

    <head prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns/fb# thetestasdf: http://ogp.me/ns/fb/thetestasdf#">
      <meta property="fb:app_id"      content="325291980834949" />
      <meta property="og:type"        content="thetestasdf:recipie" />
      <meta property="og:url"         content="www.21dads.com/testobject" />
      <meta property="og:title"       content="Cookie Recipie!" />
      <meta property="og:description" content="Tastiest recipe ever" />
      <meta property="og:image"       content="http://cdn.techpatio.com/wp-content/uploads/2009/11/cookie_law_eu.gif" />
      <title> Cookie Recipie</title>
    <head/>

    <body>
        <p> Test object page </p>
    </body>

</html>

The URL "www.21dads.com/testobject" is my controller which then generates the HTML from a view file. Why can't this URL be parsed?

Why am I getting the other "missing required property" errors when they are already included?

Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(6

情绪失控 2025-01-05 19:06:37

您应该在 og:url 内容前面添加方案(例如 http://https:// ),否则这不是网址。

在您的具体情况下,您应该将 www.21dads.com/testobject 替换为 http://www.21dads.com/testobject

You should have scheme in front of og:url content (like http:// or https:// ), or this isn't URL.

In your specific case you should replace www.21dads.com/testobject with http://www.21dads.com/testobject

雅心素梦 2025-01-05 19:06:37

要检查的可能问题的综述/清单:

  • 确保您的元标记与 URL 中的 http:// 或 https:// 匹配。
  • 确保您的元标记与 URL 中的 www 或非 www 匹配。
  • (旁注:您应该选择 http/https www/non-www 的一个组合,并将所有流量重定向到该 URL,并确保与您的 og:url 元标记匹配)
  • 检查空格URL 之前或之后
  • 检查 Facebook 强制执行的尾部斜杠是否可能不在您的元标记中
  • 检查是否有重复的“og:url”元标记
  • 检查您的 URL 是否公开可用(您无法成功使用在线调试器本地主机安装 - 一旦你安装了就检查一下在公开的临时或生产站点上)。仔细检查您是否处于受密码保护或 IP 地址受限的环境中。
  • 检查您的拼写 - URL 真的正确吗?
  • 再次抓取 URL。如果修复了它,则需要重新刮擦,而不仅仅是重试。

Roundup / checklist of possible issues to check for:

  • Make sure your meta tag matches http:// or https:// in the URL.
  • Make sure your meta tag matches www or non-www in the URL.
  • (Sidenote: You should pick one combo of http/https www/non-www and redirect all of your traffic to that URL anyways, and make sure that matches your og:url meta tag)
  • Check for whitespace before or after the URL
  • Check for a trailing slash forced by Facebook that may not be in your meta tag
  • Check for duplicated "og:url" meta tags
  • Check that your URL is publicly available (you can't use the online debugger successfully for a localhost install - check it once you're on a staging or production site that's publicly available). Double check that you're not on a password-protected or IP address restricted environment.
  • Check your spelling - is the URL really correct?
  • Scrape the URL again. If you fixed it, you need to re-scrape, not just try again.
凉薄对峙 2025-01-05 19:06:37

您可以尝试使用此 https://developers.facebook.com/tools/debug/ og/object/ 查看确切废弃的内容。无论如何,Facebook 说他们正在使用开放图,但很多人测试似乎都说他们没有。

You can try to use this https://developers.facebook.com/tools/debug/og/object/ for see what is exactly scrapped. Anyway facebook say they are using open graph, but a lot of personnals test seems to say they don't.

花之痕靓丽 2025-01-05 19:06:37

另一个可能的原因可能是重复的开放图元标签。

Another possible reason for this could be duplicated Open Graph Meta tags.

_蜘蛛 2025-01-05 19:06:37

通过评论插件使用超链接时要小心。
< div class="fb-comm en ts" data-href="http://website.com/view.php?id=323" data-width="100%" data-numposts="20">

我使用 https:// 而不是 http:// (因为我没有在服务器上安装 SSL。)

Be careful while using hyperlink through the comment plugin.
< div class=" fb - comm en ts" data - href ="http://website.com/view.php?id=323" data-width="100%" data-numposts="20">

I was using https:// instead of http:// (because I didn't have the SSL installed on the server.)

七禾 2025-01-05 19:06:37

我也有同样的问题。当我分享到 FB 时,我的帖子下面的描述显示了很多奇怪的词语,例如但仅适用于我的一些帖子(有些是正确的)。我执行了以下步骤并解决了我的问题(我不知道任何编码):

1-在我的 wp-admin 中,我检查了“文本”而不​​是“视觉”,在那里我可以奇怪地看到我的描述以及所有这些垃圾像这样的词我去掉了任何多余的词并保存了。

2-在 https://developers.facebook.com/tools/debug/og/object /,我输入了帖子页面 URL 并按下“获取新的抓取信息”,

然后 ta..rrraaa!已经修好了!

I had the same problem. The description below my posts when shared to FB, showed a lot of strange words such as but only for some of my posts (some were correct). I did below steps and fixed my problem (I don't know any coding):

1- In my wp-admin, I checked the 'TEXT' rather than 'VISUAL' where I could strangely see my description as well as all those rubbish words such as so I got rid of any extra word and saved.

2- In https://developers.facebook.com/tools/debug/og/object/, I typed the post page URL and pushed "Fetch New Scrape Information"

And ta..rrraaa! It was fixed!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文