如何使用 Manuel Schoebel 的 SEO 包动态设置每页的标题?

How can I set the title dynamically per page with Manuel Schoebel's SEO package?

使用 Meteor 1.0.3.1 和 Iron Router,我需要为某些页面动态设置标题,同时为其他页面默认设置特定标题,使用 Manuel Schoebel's SEO package。如何完成为特定路线设置动态页面标题?

我一般是这样设置 SEO 的:

Meteor.startup(->
  [...]
  SEO.config({
    title: 'MusitechHub'
    meta: {
      'description': 'The hub for finding and publishing music technology projects'
    }
  })

  undefined
)

如包 README 中所述,您可以使用 iron:router onAfterAction 挂钩将标题动态设置为您想要的任何计算值:

Router.route("/post/:slug", {
  onAfterAction: function() {
    var post = Posts.findOne({
      slug: this.params.slug
    });
    SEO.set({
      title: post.title
    });
  }
});