【问题标题】:Meteor Spiderable not returning full content?Meteor Spiderable 不返回完整内容?
【发布时间】:2013-06-24 19:25:25
【问题描述】:

以下是我当前的代码, https://github.com/daslicht/kiss

将它克隆到我的服务器后,我添加了可爬取程序包 并将 phantomjs 添加到 $PATH。

我的应用程序的基本结构本质上是一个 Master Details 布局, 在左边我们有一个标题列表(大师) 右侧是每个标题的相应详细信息。

到目前为止一切都很好......,当我调用一个页面时:

http://78.47.126.11:3000/?_escaped_fragment_=blog/SbZayHyqKmZhCEHme/1

我显示了我的标题,但没有显示相应的详细信息。

你知道可能出了什么问题吗?

目前它作为永久包运行。

最好的问候 马克

【问题讨论】:

    标签: meteor


    【解决方案1】:

    如果认为 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/whatever-site 好。

    编辑

    我误解了你的问题。我要做的是将&lt;meta name="fragment" content="!"&gt; 添加到您的脑海中,而不是使用转义片段。更多内容:https://developers.google.com/webmasters/ajax-crawling/docs/getting-started

    我仍然很确定您的数据库不会被 Google 接收。但我可能错了!

    【讨论】:

    • 标题也保存在 MongoDB 中并显示出来(尝试添加一个:),所以这不是问题。我完全同意服务器端渲染更适合被索引。非常感谢您花时间给我写一个答案!
    • 哦,我想念你的问题。您是否在网站管理员工具中查看过它?我很确定 google 不会看到 DB-stuff。
    • 根据 Meteor 文档,它应该获取任何内容,因为它只会作为使用 PhantomJs developers.google.com/webmasters/ajax-crawling/docs/… 呈现的呈现 html 返回最佳示例:tinyurl.com/o8vuneu
    【解决方案2】:

    如果我理解,您的应用会忽略“blog/SbZayHyqKmZhCEHme/1”。 错误是因为: https://github.com/meteor/meteor/issues/487

    spiderable 包目前不会重新附加转义的包 片段回到发送到 phantomjs 的 url 上,因此不可能 页面以显示正确的内容。

    例如,如果 googlebot 遇到一个 url:

    http://domain.com/#!page
    

    它将向服务器发出请求:

    http://domain.com/?_escaped_fragment_=page
    

    但是目前,spiderable 包将调用 phantomjs 以下网址:

    http://domain.com/
    

    我的解决方案是创建您自己的可爬取程序包,并通过“https://gist.github.com/4096777”进行修复

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-11-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-01-29
      • 2016-09-05
      • 1970-01-01
      相关资源
      最近更新 更多