Skip to content

Instantly share code, notes, and snippets.

@Pent
Last active December 20, 2015 10:49
Show Gist options
  • Select an option

  • Save Pent/6118274 to your computer and use it in GitHub Desktop.

Select an option

Save Pent/6118274 to your computer and use it in GitHub Desktop.
Template layout for Meteor
<body>
{{>body}}
</body>
<template name="body">
{{renderPage layoutName}}
</template>
<template name="adminLayout">
{{>adminHeader}}
{{>alerts}}
{{renderPage}}
</template>
<template name="defaultLayout">
{{>defaultHeader}}
{{>alerts}}
{{renderPage}}
</template>
Meteor.Router.add({
'/': {to: 'home', as: 'home' },
'/admin': {to: 'admin', as: 'admin' }
});
Template.body.helpers({
layoutName: function() {
switch (Meteor.Router.page()) {
case 'home':
return 'defaultLayout';
case 'admin':
return 'adminLayout';
default:
return 'defaultLayout';
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment