Facebook支持Hash Bang#! Ajax可追溯网址? [英] Does Facebook support Hash Bang #! Ajax Crawlable Urls?

查看:137
本文介绍了Facebook支持Hash Bang#! Ajax可追溯网址?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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



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



我有这个URL可以去直接加载注意#!在url:



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



在我的 Like 这个页面就应该抓取该 逃片段 网址:



HTTP://www.idkshouldi。 COM /?_ escaped_fragment_ = idkDetails_idkKey = agppZGtzaG91bGRpcmMLEiljb21faWRrc2hvdWxkaV93ZWJfc2VydmVyX2dhZV9vYmpfSWRrVXNlciIDamltDAsSKWNvbV9pZGtzaG91bGRpX3dlYl9zZXJ2ZXJfZ2FlX29ia l9JZGtJdGVtGN6kBgw



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



它不会正确地抓取一个启用AJAX的URL与#!在里面。这是Google的规范。 Facebook的绒毛爬虫需要做的是更换#!与_escaped_fragment_。它似乎没有这样做与我的AJAX启用的链接。

解决方案

这也是一个大问题,但不幸的是看来Facebook不支持这种Google URL表示法。 Facebook的抓取器/解析器不会从哈希bang(#!)转换为_escaped_fragment_格式的URL。



像您已经在Facebook的URL linter上测试了我的页面,它只选择在动态原始页面中打开静态Open Graph标签,而不是页面的_escaped_fragment_服务器端变体中的特定于页面的Open Graph标签。不幸的是,这意味着Facebook将我的Open Graph标签视为站点特定的,而不是特定页面。



这是一个讽刺的是,这似乎不受支持,因为Facebook使用这种方法本身就允许Google的抓取工具接收Facebook页面。



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



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





这肯定只是一个Facebook新增支持之前的时间问题只会变得越来越流行。


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.

解决方案

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.

这篇关于Facebook支持Hash Bang#! Ajax可追溯网址?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆