Spiderable包如何与Meteor一起使用?

Kyl*_*ley 15 javascript search-engine google-webmaster-tools meteor

我已将spiderable包软件包添加到我的Meteor应用程序中,并且?_escaped_fragment_=在网址中发出请求时会返回页面的html版本,但我无法让Google抓取该网站.

细节

Google网站站长工具中使用Fetch as Google并请求根页面时,页面返回是javascript版本; 就像是:"http://example.com/"

HTTP/1.1 200 OK
content-type: text/html; charset=utf-8
date: Fri, 30 Nov 2012 05:39:36 GMT
connection: Keep-alive
transfer-encoding: chunked

<!DOCTYPE html>
<html>
  <head>
    <link rel="stylesheet" href="/e83157bdc4ff057fa3a20b82af4c11b4ebe776e7.css">
    <script type="text/javascript">
      __meteor_runtime_config__ = {"ROOT_URL":"http://www.example.com","DEFAULT_DDP_ENDPOINT":"https://www-example-com-ddp.meteor.com/"};
    </script>
    <script type="text/javascript" src="/13cf3d21ce1c4a88407ca5f3c250f186ab1738f9.js"></script>
    <meta name="fragment" content="!">
    <title>example.com</title>
  </head>
<body>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)

相反,我要求http://example.com/?_escaped_fragment_=返回html版本:

HTTP/1.1 200 OK
content-type: text/html; charset=UTF-8
date: Wed, 05 Dec 2012 02:44:09 GMT
connection: Keep-alive
transfer-encoding: chunked

<!DOCTYPE html>
<html>
  <head>
    <link rel="stylesheet" href="/e83157bdc4ff057fa3a20b82af4c11b4ebe776e7.css">
    <title>example.com</title>
    <meta name="viewport" content="initial-scale=1.0">
  </head>
  <body>
    <ul>
      <li><a href="/">Home</a></li>
      <li><a href="/one">One</a></li>
      <li><a href="/two">Two</a></li>
    </ul>
  </body>
</html>
Run Code Online (Sandbox Code Playgroud)

问题

  • 你如何告诉谷歌添加?_escaped_fragment_=到网址,以便它呈现html版本?

  • ?_escaped_fragment_= 如果网址没有 hashbang(!#),谷歌仍然会添加到网址吗?即/home,/products/1而不是/!#home,/!#products/1

  • 如何让Google关注链接页面?并追加?_escaped_fragment_=?页面的所有js版本都<meta name="fragment" content="!">在标题中.我认为这就是所需要的.

似乎最简单的解决方案是更新splerable包的更新以将html版本返回到Google Bot,而不是要求?_escaped_fragment_=,但如果这对其他人有用,我很好奇,我做错了什么.

附加信息

Meteor的spiderable包是一个临时解决方案,允许Web搜索引擎索引Meteor应用程序.

根据消息来源,它做了一些事情:

  1. 它将以下标记添加到head页面的js版本部分:

    <head><meta name="fragment" content="!"></head>

  2. 使用PhantomJS它解析javascript应用程序并在满足以下任一条件时返回html版本:

    一个.请求用户代理是"facebookexternalhit"

    湾 请求的URL包含字符串?_escaped_fragment_=

Kyl*_*ley 6

我认为这是一个"Google网站管理员工具"错误.

Google似乎确实正在抓取该网站 - 这些网页显示在Google搜索结果中.但是,Google网站管理员工具仍然将所有索引页面列为1.但Bing仍未抓取该页面.

编辑: 谷歌网站管理员工具页面列为

未选中:未编入索引的页面,因为它们与其他页面基本相似,或者已重定向到其他URL.更多信息.

编辑2:回应乔纳坦的问题:

?_escaped_fragment_=如果网址没有hashbang(!#),谷歌仍然会添加到网址吗?

是.我的应用程序不在URL中使用hashbangs(!#).谷歌机器人?_escaped_fragment_=在抓取时仍会附加.这是日志的一个例子:

INFO HIT /url/2/01 66.249.72.42
INFO HIT /url/2/01?_escaped_fragment_= 66.249.72.142
INFO HIT /url/2/01 108.162.222.82
INFO HIT /url/2/01?_escaped_fragment_= 108.162.222.82
INFO HIT /url/2/05 108.162.222.82
INFO HIT /url/2/05?_escaped_fragment_= 108.162.222.214
Run Code Online (Sandbox Code Playgroud)

似乎谷歌机器人将尝试使用和不使用的网址 ?_escaped_fragment_=