Using a second master layout

I have one master layout that i have been using for my app.I have a generated my app using iron-cli package and my master layout is called master_layout.html

t i now have a problem. All my app menus are all in he master layout and i need to create a login page that will not require the menus. This can be solved,if i had a second master layout whereby i can strip the menus off my original master layout and use the layout for my login page.

My route looks like this

Router.route('/Limit/ay', {
  name: 'ay',
  controller: 'LimitController',
  action: 'ay',
  where: 'client'
});

and my controller code looks like this

  ay: function() {
      this.render('Ay');
    //this.render('Added', {});
  }

Is there a way i can register a second master layout and use it for my login page?.

As long as you’ve registered the layout, you can specify it per route. Something like:

...
Router.configure({
  layoutTemplate: 'masterLayout'
});

Router.configure({
  layoutTemplate: 'loginLayout'
});
...

Router.route('/',  {
  layoutTemplate: 'masterLayout'
});

Router.route('/login', {
  layoutTemplate: 'loginLayout'
});
...

When i register this two templates

Router.configure({
  layoutTemplate: 'MasterLayout',
  loadingTemplate: 'Loading',
  notFoundTemplate: 'NotFound'
});

Router.configure({
  layoutTemplate: 'GoodLayout'
});

meteor is using good layout as master layout and if master layout is second,meteor is using master layout as master layout.Have a look at the api http://iron-meteor.github.io/iron-router/#layouts

Right, but are you specifying the layout you want to use on your route?

Router.route('/login', {
  layoutTemplate: 'loginLayout'
});
1 Like

Just to add - you don’t really need to Router.configure() a layout; that’s only if you want a default. Specifying a layoutTemplate on your route will always work, without having it previously defined. So this might be better for you:

...
Router.configure({
  layoutTemplate: 'defaultLayout'
});
...
Router.route('/',  {
  ...
});

Router.route('/login', {
  layoutTemplate: 'loginLayout'
});
...

P.S. --> You might also want to consider moving away from using Iron Router. See the Guide’s current router recommendations.

Thanks,that worked. Does Fow Router generate the app structure for you?.