Reactive page title for meteor within iron-router
Change document.title
on the fly within iron-router
Install:
meteor add ostrio:iron-router-title
Usage:
Simple set title
property in router configuration:
1# Set default document.title value in 2# case router has no title property 3document.title = 'My Meteor App Title' 4 5Router.map -> 6 Router.route 'account', 7 template: 'account' 8 path: '/me/account' 9 title: 'My Account'
To change title
reactively, just pass it as function:
1Router.map -> 2 Router.route 'account', 3 template: 'account' 4 path: '/me/account' 5 title: () -> 6 i18n.get 'account.document.title'
In this example we used ostrio:i18n package