Skip to content

Instantly share code, notes, and snippets.

@yeputons
Created February 12, 2014 18:31
Show Gist options
  • Save yeputons/8961667 to your computer and use it in GitHub Desktop.
Save yeputons/8961667 to your computer and use it in GitHub Desktop.
<template name="layout">
<p>Current page = {{currentPage}}</p>
<p><a href="/">Main</a></p>
<p><a href="/notfound">Not found</a></p>
{{yield}}
</template>
<template name="main">
<p>Main page</p>
</template>
<template name="not_found">
<p>Not found page</p>
</template>
Router.configure({
layoutTemplate: 'layout',
notFoundTemplate: 'not_found',
});
Router.route('main', {path: '/'});
if (Meteor.isClient) {
Template.layout.helpers({
currentPage: function() {
if (!Router.current())
return '<not-found>';
return Router.current().template;
}
});
}
{
"packages": {
"iron-router": {}
}
}
{
"meteor": {},
"dependencies": {
"basePackages": {
"iron-router": {}
},
"packages": {
"iron-router": {
"git": "https://github.com/EventedMind/iron-router.git",
"tag": "v0.6.2",
"commit": "ce56e58b45624dce992490f3a1c10f10d3948bae"
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment