【问题标题】:Ajax magic: How is Kotaku achieving Ajax *and* Google accessability?Ajax 魔法:Kotaku 如何实现 Ajax *和* Google 可访问性?
【发布时间】:2011-05-10 18:00:01
【问题描述】:

Kotaku 推出了没有 hashbang 的新设计。他们的网站仍然清楚地使用 ajax 请求,但不知何故,它仍然可以通过 Google 找到,并且内容显示在 pagesource 中。他们是如何做到的呢?他们的文本似乎包含在脚本 type=text/javascript 中,但我不明白这有什么影响,或者他们为什么要这样做。 (当然,第一个页面请求可能只是触发了一个静态的,服务器端构造的响应。但是查看其他文章,它确实通过ajax请求加载了json。没有页面刷新)

例如看看这个网站:

http://kotaku.com/5800326/read-some-of-new-tomb-raider-game-right-now

没有哈希,一个格式非常好的 URL,它出现在 Google 中。我已阅读 Google Ajax 指南,据我了解,如果您使用 #!,Google 只会请求 html 快照。在你的网址里面。

为方便起见,我制作了一个屏幕截图,显示了文本在 Chrome 调试器中的外观:(“ganjaAjaxContent”是什么意思?)

如果你搜索这篇文章,它是谷歌中的第一个匹配: Google search for Kotaku article

能够在不必担心 Google 搜索的情况下执行 ajax 将非常棒。

【问题讨论】:

    标签: ajax seo


    【解决方案1】:

    Kotaku 和其他 Gawker 网站正在为 SEO 做很多事情:

    • 为其所有内容提交 XML 站点地图
    • 正确使用 Google 和 Facebook 的标题和描述标签

      • <title>Read Some of New Tomb Raider Game Right Now</title>
        <meta name="fragment" content="!">
        <meta name="title" content="Read Some of New Tomb Raider Game Right Now" />
        <meta name="description" content="Upcoming Tomb Raider reboot doesn&#039;t have a release date yet, but website Siliconera apparently has the game&#039;s script and published what&#039;s reportedly an excerpt from it. Check it out. [Siliconera]" />
        <meta property="og:title" content="Read Some of New Tomb Raider Game Right Now" />
        <meta property="og:description" content="Upcoming Tomb Raider reboot doesn't have a release date yet, but website Siliconera apparently has the game's script and published what's reportedly an excerpt from it." />
    • 关闭 Javascript 时显示 HTML 帖子内容(检查 &lt;div class="post-body quick-post"&gt;&lt;/div&gt; 元素)

    所以您是对的,Google 的第一次访问会加载语义化、可访问的服务器端构建页面。虽然 Google 可以 抓取 hashbang 页面,但它不需要,因为所有页面都通过 sitemap.xml 编制索引

    希望这能回答你所有的问题。

    附言说了这么多,hashbangs 对网络来说还是很糟糕的

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2010-12-02
      • 1970-01-01
      • 1970-01-01
      • 2011-01-04
      相关资源
      最近更新 更多