Facebook 是否支持 Hash Bang #! Ajax 可抓取 URL?

发布于 2024-12-12 19:39:49 字数 1376 浏览 2 评论 0原文

Facebook 是否支持 Google 的 ajax 抓取规范?如果支持,您需要做什么来实现它?

我正在尝试让 Facebook“喜欢”按钮与此处定义的 AJAX 可抓取网址一起使用:code.google.com/web/ajaxcrawling/docs/specation.html

我有这个网址,我可以直接访问它并加载。注意“#!”在网址中:

http://www.idkshoudi.com/?#!idkDetails_idkKey=agppZGtzaG91bGRpcmMLEiljb21faWRrc2hvdWxkaV93Z WJfc2VydmVyX2dhZV9vYmpfSWRrVXNlciIDamltDAsSKWNvbV9pZGtzaG91bGRpX3dlYl9zZXJ2ZXJfZ2FlX29ial9JZGtJdGVtGN6kBgw

当我“喜欢”此页面时,它应该抓取此“转义片段”网址:

http://www.idkshoudi.com/?_escaped_fragment_=idkDetails_idkKey=agppZGtzaG91bGRpcmMLEiljb21faWRrc2hvd WxkaV93ZWJfc2VydmVyX2dhZV9vYmpfSWRrVXNlciIDamltDAsSKWNvbV9pZGtzaG91bGRpX3dlYl9zZXJ2ZXJfZ2FlX29ial9JZGtJdGVtGN6kBgw

为什么它不会抓取此页面? Facebook linter 无法正确抓取我的页面。如果在这里使用 Facebook linter 工具:developers.facebook.com/tools/debug

它将无法正确抓取带有“#!”的 AJAX 启用 URL。在其中。这是谷歌的规范。 Facebook的lint爬虫需要做的就是替换掉“#!”与“_escaped_fragment_”。我的启用 AJAX 的链接似乎没有这样做。

Does Facebook support Google's ajax crawling specification and, if so, what do you need to do to implement it?

I am trying to get the Facebook "Like" button to work with AJAX crawlable urls as defined here: code.google.com/web/ajaxcrawling/docs/specification.html

I have this url which I can go to directly and it loads. Note the "#!" in the url:

http://www.idkshouldi.com/?#!idkDetails_idkKey=agppZGtzaG91bGRpcmMLEiljb21faWRrc2hvdWxkaV93ZWJfc2VydmVyX2dhZV9vYmpfSWRrVXNlciIDamltDAsSKWNvbV9pZGtzaG91bGRpX3dlYl9zZXJ2ZXJfZ2FlX29ial9JZGtJdGVtGN6kBgw

When I "Like" this page it should crawl this "escaped fragment" url:

http://www.idkshouldi.com/?_escaped_fragment_=idkDetails_idkKey=agppZGtzaG91bGRpcmMLEiljb21faWRrc2hvdWxkaV93ZWJfc2VydmVyX2dhZV9vYmpfSWRrVXNlciIDamltDAsSKWNvbV9pZGtzaG91bGRpX3dlYl9zZXJ2ZXJfZ2FlX29ial9JZGtJdGVtGN6kBgw

Why won't it crawl this page? The Facebook linter is not properly crawling my page. If one uses the Facebook linter tool here: developers.facebook.com/tools/debug

It won't properly crawl an AJAX enabled URL with the "#!" in it. This is Google's specification. What Facebook's lint crawler needs to do is to replace the "#!" with "_escaped_fragment_". It doesn't appear to do that with my AJAX enabled links.

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

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

发布评论

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

评论(1

云之铃。 2024-12-19 19:39:49

这对我来说也是一个大问题,但不幸的是 Facebook 似乎不支持这种 Google URL 表示法。 Facebook 的爬虫/解析器不会将 hash bang (#!) 转换为 _escaped_fragment_ 格式的 URL。

和你一样,我在 Facebook 的 URL linter 上测试了我的页面,它只选取动态原始页面中的静态开放图谱标签,而不是我页面的 _escaped_fragment_ 服务器端变体中特定于页面的开放图谱标签。不幸的是,这意味着 Facebook 将我的开放图谱标签视为特定于站点,而不是特定于页面。

具有讽刺意味的是,这似乎不受支持,因为 Facebook 本身就使用这种方法来允许 Google 的爬虫抓取 Facebook 页面。

一个可能对您有一点帮助的潜在解决方法是:

1) 在 Facebook 链接中使用您的 _escaped_fragment_ 页面版本
2) 添加自动重定向到您的 _escaped_fragment_ 变体到正确的版本。

这应该意味着 Facebook 将选择正确的元标记,用户将单击链接并最终到达正确的页面。这种方法的缺点是用户必须知道相当丑陋的 _escaped_fragment_ URL。换句话说,可能只有您知道,除非您在页面上添加某种“生成可共享链接”按钮。

Facebook 添加对此的支持肯定只是时间问题,因为单页哈希爆炸网站只会变得更加普遍。

This is also a big problem for me, but unfortunately it appears Facebook does not support this Google URL notation. Facebook's crawler/parser does not translate from hash bang (#!) to an _escaped_fragment_ format URL.

Like you I have tested my page on Facebook's URL linter and it only picks up static Open Graph tags within the dynamic original page, rather than the page-specific Open Graph tags in the _escaped_fragment_ server-side variant of my page. Unfortunately, this means that Facebook sees my Open Graph tags as site-specific, rather than page specific.

It is rather an irony that this appears to be unsupported as Facebook uses this approach itself to allow Google's crawlers to pick up Facebook pages.

One potential workaround, that may help you a little bit, is:

1) Use your _escaped_fragment_ page version in Facebook links
2) Add an automatic redirect to your _escaped_fragment_ variant to the proper version.

This should mean that Facebook will pick up the proper meta tags, and the user will click the link and end up on the correct page. The downside of this approach is that the user has to know the rather ugly _escaped_fragment_ URL. In other words, it will probably only be you that knows it, unless you add some sort of 'generate shareable link' button to your page.

It is surely only a matter of time before Facebook adds support for this as single-page hash bang sites are only going to become more prevalent.

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