og:type hotel 被忽略

发布于 2025-01-01 09:35:25 字数 1742 浏览 2 评论 0 原文

我正在尝试使用以下标头为度假公寓的网站设置 opengraph 标签:

<meta property="og:title" content="Hotel Test"/>
<meta property="og:type" content="hotel"/>
<meta property="og:url" content="http://dl.dropbox.com/u/256059/fb_hotel_debug/index.html"/>
<meta property="og:image" content="http://dl.dropbox.com/u/256059/random%20pictures/testen.jpg"/>
<meta property="og:description" content="Hello World!"/>
<meta property="og:latitude" content="53.554073"/>
<meta property="og:longitude" content="9.9861"/>
<meta property="og:street-address" content="ABC-Straße 19"/>
<meta property="og:locality" content="Hamburg"/>
<meta property="og:postal-code" content="20354"/>
<meta property="og:country-name" content="Germany"/>
<meta property="og:locale" content="de_DE"/>

不知何故 Facebook 只是忽略 og:type hotel 并将其重置为网站:http://bit.ly/wqHL1T

{
   "url": "http://dl.dropbox.com/u/256059/fb_hotel_debug/index.html",
   "type": "website",
   "title": "Hotel Test",
   "locale": {
      "locale": "de_de"
   },
   "image": [
      {
         "url": "http://dl.dropbox.com/u/256059/random\u002520pictures/testen.jpg"
      }
   ],
   "description": "Hello World!",
   "updated_time": "2012-01-30T22:45:36+0000",
   "id": "10150640100800309"
}

我在这里遗漏了什么吗?因此,所有其他标签(例如纬度和经度)都将被忽略...

相关链接:
调试页面
Facebook 调试器

I'm trying to set the opengraph tags for a website of a holiday flat with the following headers:

<meta property="og:title" content="Hotel Test"/>
<meta property="og:type" content="hotel"/>
<meta property="og:url" content="http://dl.dropbox.com/u/256059/fb_hotel_debug/index.html"/>
<meta property="og:image" content="http://dl.dropbox.com/u/256059/random%20pictures/testen.jpg"/>
<meta property="og:description" content="Hello World!"/>
<meta property="og:latitude" content="53.554073"/>
<meta property="og:longitude" content="9.9861"/>
<meta property="og:street-address" content="ABC-Straße 19"/>
<meta property="og:locality" content="Hamburg"/>
<meta property="og:postal-code" content="20354"/>
<meta property="og:country-name" content="Germany"/>
<meta property="og:locale" content="de_DE"/>

Somehow Facebook just ignores the og:type hotel and resets it to website: http://bit.ly/wqHL1T

{
   "url": "http://dl.dropbox.com/u/256059/fb_hotel_debug/index.html",
   "type": "website",
   "title": "Hotel Test",
   "locale": {
      "locale": "de_de"
   },
   "image": [
      {
         "url": "http://dl.dropbox.com/u/256059/random\u002520pictures/testen.jpg"
      }
   ],
   "description": "Hello World!",
   "updated_time": "2012-01-30T22:45:36+0000",
   "id": "10150640100800309"
}

Am I missing something here? Because of this all the other tags like latitude and longitude are ignored...

Relevant links:
Debug page
Facebook Debugger

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

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

发布评论

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

评论(2

许仙没带伞 2025-01-08 09:35:25

这些都是已弃用的标签。请参阅 http://ogp.me 了解最新文档。

Those are all deprecated tags. Please see http://ogp.me for current documentation.

琉璃繁缕 2025-01-08 09:35:25

我最近遇到了同样的问题。 Facebook 一直忽略所有元标签。

花了我一段时间,最后我使用了 Facebook 调试工具 > “抓取 URL”来真正检查我的代码。 这个工具可以准确地向您显示 Facebook 爬虫所看到的内容。

我注意到我的 HTML 代码中混杂着 php 错误。这些错误从未出现在 IE、FF 或 Chrome 的源代码中。就我而言,这与我的浏览器检测代码有关。 Facebook 爬虫的 user_agent 不在我的列表中,导致我的检测代码生成错误消息,从而破坏了 HTML 标记。我修复了我的功能,一切又开始工作了!

我建议您检查您的网站:
http://developers.facebook.com/tools/debug/og/echo ?q=YOUR_WEBSITE_URL_HERE

(或使用 https://developers.facebook.com/tools/debug,输入您的网址并按页面底部的“Scraped URL”。)

检查是否有混入的垃圾代码部分。如果有,那么 Facebook 将无法解析元标记。

I encountered the same problem recently. Facebook keeps on ignoring all the meta tags.

Took me a while, but finally I used Facebook Debug Tool > "Scraped URL" to really inspect my code. This tool shows you exactly what Facebook crawler sees.

I noticed there are php errors mixed in with my HTML code. These errors never appeared in the source code for IE, FF or Chrome. In my case, it was to do with my browser detection code. Facebook's crawler's user_agent was not on my list and caused my detection code to generate error messages which broke the HTML markup. I fixed my function and everything started to work again!

I suggest you check your website with:
http://developers.facebook.com/tools/debug/og/echo?q=YOUR_WEBSITE_URL_HERE

(Or use https://developers.facebook.com/tools/debug , type in your URL and press "Scraped URL" at the bottom of the page.)

Check whether there are garbage codes mixed into the <head></head> section. If there is, then Facebook will fail to parse the meta tags.

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