ostrio:iron-router-title

v0.2.2Published 10 years ago

This package has not had recent updates. Please investigate it's current state before committing to using it in your project.

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
3Router.configure
4  title: 'Default title'
5
6Router.route 'account',
7  template: 'account'
8  path: '/me/account'
9  title: 'My Account'

Use function context:

1Router.route 'account',
2  template: 'account'
3  path: '/me/account'
4  title: () ->
5    this.data().getTitle()
6  data: ->
7    getTitle: ->
8      Collection.Posts.findOne('someId').title

To change title reactively, just pass it as function:

1Router.route 'account',
2  template: 'account'
3  path: '/me/account'
4  title: () ->
5    i18n.get 'account.document.title'

In this example we used ostrio:i18n package