This is easy to do with iron:router layouts and applying different classes to each page using routing.
First you need to define the main layout, for example:
<template name="mainLayout"> {{> yield region="navbar"}} <div class="{{currentRouteName}}-page"> {{> yield}} </div> {{> yield region="footer"}} </template>
The currentRouteName helper should look something like this:
UI.registerHelper("currentRouteName",function(){ return Router.current()?Router.current().route.getName():""; });
Then I recommend linking the RouteController to your main layout, which will serve as the base class for all your RouteController s.
MainController=RouteController.extend({ layoutTemplate:"mainLayout", // yield navbar and footer templates to navbar and footer regions respectively yieldTemplates:{ "navbar":{ to:"navbar" }, "footer":{ to:"footer" } } });
Then you need to make sure that your routes use the controller that is obtained from MainController .
HomeController=MainController.extend({ template:"home" }); Router.map(function(){ this.route("home",{ path:"/", // optional, by default iron:router is smart enough to guess the controller name, // by camel-casing the route name and appending "Controller" controller:"HomeController" }); });
So, now your route homepage is surrounded by a div that has a homepage class, so you can style it in plain CSS (or, even better, using LESS):
.home-page{ }
If you define other routes, this will work MainController , just inherit from MainController , and you will have a page with the class of the route name automatically.
Of course, you can use the same style for multiple pages, just specify it in CSS:
.home-page, .contact-page{ }
You can do really nice things with layouts, I highly recommend using them.