流星搜索引擎优化

时间:2015-04-19 17:35:21

标签: javascript meteor seo

关注此博客post我使用此package来设置我的搜索引擎优化。当页面标题在标题栏上正确显示时,当我curl http://localhost:3000/about -4进入网页时,我看不到任何元标记。我正在设置与以下文档完全相同的所有内容:

Router.route('/about', {
  'name': 'About',

  'action': function() {
    this.render('About', {
      to: 'content'
    });
  },

  'onAfterAction': function() {
    if (!Meteor.isClient) {
      return;
    }

    SEO.set({
      title: "My website",
      meta: {
        'description': "testing."
      }
    });
  }
});

2 个答案:

答案 0 :(得分:3)

SEO包修改浏览器上的标签。这意味着如果您在浏览器中加载它。

要使用curl查看它,请确保您已安装spiderable个软件包,安装了phantomjs并使用curl http://localhost:3000/about?_escaped_fragment_=#

查看您的路线

根据AJAX web crawling spec

,这将强制使用phantomjs使用spiderable包呈现它

答案 1 :(得分:-1)

curl没有运行JS。所以流星类的东西都不起作用。您需要服务器端渲染。检查this blog

相关问题