使GWT应用程序可以通过搜索引擎进行抓取 [英] Making GWT application crawlable by a search engine
问题描述
我想使用#!
令牌使我的GWT应用程序可以被抓取,如下所述:
http://code.google.com/web/ajaxcrawling/
I want to use the #!
token to make my GWT application crawlable, as described here:
http://code.google.com/web/ajaxcrawling/
有是一个可以在线使用的GWT示例应用程序,例如:
http://gwt.google.com/samples/Showcase/Showcase.html#!CwRadioButton
There is a GWT sample app available online that uses this, for example: http://gwt.google.com/samples/Showcase/Showcase.html#!CwRadioButton
将以下静态网页投放到Googlebot:
http://gwt.google.com/samples/ Showcase / Showcase.html?_escaped_fragment_ = CwRadioButton
Will serve the following static webpage to the googlebot: http://gwt.google.com/samples/Showcase/Showcase.html?_escaped_fragment_=CwRadioButton
我希望我的GWT应用程序能够做类似的事情。简而言之,只要在URL中找到 _escaped_fragment _
参数,我就想为页面提供不同的风格。
I want my GWT app to do something similar. In short, I'd like to serve a different flavor of the page whenever the _escaped_fragment_
parameter is found in the URL.
我应该修改哪些内容才能让服务器提供其他内容(静态页面或通过无头浏览器动态生成的页面,如 HTML单元)?我猜它可能是 web.xml
文件,但我不确定。
What should I modify in order for the server to serve something else (a static page, or a page dynamically generated through a headless browser like HTML Unit)? I'm guessing it could be the web.xml
file, but I'm not sure.
(注意:我想检查GWT SDK提供的Showcase应用程序,但不幸的是它似乎不支持在 _escaped_fragment _
并且它不使用#!
标记..)
(Note: I thought of checking the Showcase app provided with the GWT SDK, but unfortunately it doesn't seem to support serving static files on _escaped_fragment_
and it doesn't use the #!
token..)
推荐答案
找到我的答案! Showcase
支持可抓取超链接的示例位于以下分支中:
http://code.google.com/p/google-web-toolkit/source/browse/branches/ crawlbility / samples / showcase /?r = 7726
Found my answer! The Showcase
sample supporting crawlable hyperlinks is in the following branch:
http://code.google.com/p/google-web-toolkit/source/browse/branches/crawlability/samples/showcase/?r=7726
它在 web.xml中定义一个过滤器
使用 _escaped_fragment _
标记将URL重定向到HTML单元的输出。
It defines a filter in the web.xml
to redirect URLs with the _escaped_fragment_
token to the output of HTML Unit.
这篇关于使GWT应用程序可以通过搜索引擎进行抓取的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!