Reputation: 67997
With Meteor 1.0.3.1 and Iron Router, I need to set the title dynamically for some pages, while defaulting to a certain title for other pages, using Manuel Schoebel's SEO package. How can I accomplish setting a dynamic page title for a certain route?
I've set SEO up generally like this:
Meteor.startup(->
[...]
SEO.config({
title: 'MusitechHub'
meta: {
'description': 'The hub for finding and publishing music technology projects'
}
})
undefined
)
Upvotes: 1
Views: 545
Reputation: 22696
As stated in the package README, you can use an iron:router
onAfterAction
hook to dynamically set the title to whatever computed value you want :
Router.route("/post/:slug", {
onAfterAction: function() {
var post = Posts.findOne({
slug: this.params.slug
});
SEO.set({
title: post.title
});
}
});
Upvotes: 2