Reputation:
I have a {{> staticFooter}} template and a {{> staticHeader}} template. I was wondering if there exists a good way to render between these two templates for each page that I use iron:router to navigate to.
{{> staticHeader}}
RENDER Iron:Router STUFF HERE
{{> staticFooter}}
Upvotes: 0
Views: 69
Reputation: 131
Create a template that will serve as the layout for all of your pages.
<template name="MasterLayout">
<div id="wrapper">
<!-- Page wrapper -->
<div id="page-wrapper">
<!-- Header -->
{{> staticHeader }}
<!-- Main view -->
{{> yield}}
<!-- Footer -->
{{> staticFooter }}
</div>
<!-- End page wrapper-->
</div>
<!-- End wrapper-->
</template>
Configure your router to use this template as the default layout:
Router.configure({
layoutTemplate: 'MasterLayout'
});
Create templates for each of your pages:
<template name="Content">
<div>
<p>Render Iron:Router STUFF HERE</p>
</div>
</template>
Create a route for each page:
Router.route('/', function(){
this.render('Content'); // Render the Content template into the 'main' yield region
});
Upvotes: 1