以下是我目前的代码, https://github.com/daslicht/kiss
将其克隆到我的服务器后,我添加了spiderable包 并将phantomj添加到$ PATH。
我的应用程序的基本结构基本上是Master Details布局, 在左边我们有一个标题列表(主) 在右侧,每个标题的相关细节。
到目前为止一直很好......,当我用一个页面调用:
http://78.47.126.11:3000/?_escaped_fragment_=blog/SbZayHyqKmZhCEHme/1
我显示了我的标题,但没有显示相应的详细信息。
你知道可能出现什么问题吗?
目前它正在以永久的方式运行。
最诚挚的问候 马克
答案 0 :(得分:0)
如果认为Spiderable包不会显示来自MongoDB的内容,只显示静态模板内容。
所以在这个例子中只显示静态内容,而不是DB-loop:
<template name="main">
{{> thisWillBeOutputted}}
</template>
<template name="thisWillBeOutputted">
<h1>This will be displayed, sweet!</h1>
{{#each thisLoopFetchesStuffFromDBAndWontShow}}
<!-- stuff in this loop won't be displayed :( -->
<p>Something which won't be displayed: {{dbDoc.something}}</p>
{{/each}}
</template>
总结(我认为是正确的):
Spiderable软件包比没有显示任何机器人(这是vanilla-meteor的情况)更好,但它不如一个好的旧PHP /无论什么网站。
修改强>
我误解了你的问题。我要做的是将<meta name="fragment" content="!">
添加到您的头部,而不是使用转义碎片的东西。更多信息:https://developers.google.com/webmasters/ajax-crawling/docs/getting-started
我仍然非常确定你的数据库内容不会被Google收录。但我可能错了!
答案 1 :(得分:0)
如果我明白,你的应用程序忽略了'blog / SbZayHyqKmZhCEHme / 1'。 错误是因为: https://github.com/meteor/meteor/issues/487
spiderable包目前没有重新附加转义 片段回到发送给phantomjs的网址,所以这是不可能的 页面显示正确的内容。
例如,如果googlebot遇到网址:
http://domain.com/#!page
它将从服务器发出请求:
http://domain.com/?_escaped_fragment_=page
但是目前,spiderable包将调用phantomjs 以下网址:
http://domain.com/
我的解决方案是使用'https://gist.github.com/4096777'
修复您自己的spiderable包