Hello, when I include {{> yield}} inside a template it somehow alters the behavior of another template (loginButtons disappear from this other template) rather than showing the templates within the template where {{> yield}} is located.
This {{> yield}} is located in a page that is only viewable when a user is logged-in, and the page where the loginButtons disappear is the home page that all users should see when they are not logged in. What I am hoping to achieve is to have users come in to the home page, login and then see the loggedinlayout where different templates will appear based on what users will select from a navbar menu.
This is the code in my router.js file:
Router.map(function(){
// Home
this.route(‘home’, {
path: ‘/’
});
// Logged-in Layout landing
this.route(‘loggedinlayout’,{
layoutTemplate: ‘loggedinlayout’,
path: ‘/loggedinlayout’,
template: ‘welcome’
});
});
var requireLogin = function() {
if (! Meteor.user()) {
this.render(‘home’);
Session.set(‘firstLogin’, true);
} else {
this.render(‘loggedinlayout’);
Session.set(‘firstLogin’, false);
}
};
Router.onBeforeAction(requireLogin);
And this is the code in my html page where {{> yield}} is located:
> <template name="loggedinlayout">
>
> <head>
> ...
> </head>
> <body id="loggedinlayout">
> {{> navbar}}
> <div class=" container-fluid row" id="loggedinlayout-body">
> {{> yield}}
> </div>
> </body>
> </template>
Any help or advice would be very appreciated. Thanks!