使基于 ajax 的网页可编入索引

Make indexable an ajax based webpage

我想让我的基于 ajax 的网站可索引。

我已经阅读了这个文档:https://developers.google.com/webmasters/ajax-crawling/docs/getting-started但是我完全不明白。

我认为我需要这样做:

  1. 在网页中写这个标签,例如:www.myweb.com/mypage

    <meta name="fragment" content="!">
    
  2. 我正在为我的 Tomcat 服务器 (http://tuckey.org/urlrewrite/) 使用 UrlRewriteFilter,所以我想我可以使用子字符串重定向 url:“?_escaped_fragment_ = 到 html 快照(我可以手动构建,编写我的自定义 meta-description、标题和内容???)

    <rule>
       <from>^/mypage\?_escaped_fragment_=</from>
       <to type="forward">/snapshots/mypage.html</to>
    </rule>
    
  3. 将网址(不含转义片段)写入 sitemap.xml

    ...
    <url>
    <loc>www.myweb.com/mypage</loc>
    ...
    </url>
    ...
    

对吗?我需要做更多的事情吗?

好的,是的,但是UrlRewriteFilter语法有点不同:

<rule>

    <condition name="_escaped_fragment_" type="parameter" operator="equal"></condition>

    <from>^/mypage/</from>

    <to last="true">/snapshots/mypage.html</to>

</rule>