铁路由器:路由仅在通过应用程序访问URL时有效

时间:2015-10-23 23:50:10

标签: javascript meteor iron-router

在我的流星应用程序中,我有博客文章,博客帖子的路径为http://localhost:3000/blog/test

出于某种原因,如果通过应用程序访问该页面,则每篇博文的页面将仅加载数据。如何通过应用程序访问路由?所以我可以发推文http://localhost:3000/blog/test,当人们看到链接时,博客页面的数据会在那里。

这是博客页面的路线

Router.route('/blog/:slug', {
    name: 'articlePage',
    layoutTemplate: 'articlePage',
    data: function() {
        var post;
        post = Articles.findOne({slug: this.params.slug});
        SEO.set({
          title: post.title,
          meta: {
            'description': post.body
          },
          og: {
            'title': post.title,
            'description': post.body
          }
        });
        return post;
    }
});

点击此链接是为了访问将加载数据的路线。

<a href="{{pathFor 'postPage'}}" class="panel-link">

编辑:

这是订阅代码

articleSearchkeyword = Session.get('article-search-query');
articlesHandle = Meteor.subscribeWithPagination("articles", articleSearchkeyword, 12);

0 个答案:

没有答案