I have a large CTA-type button for a submitting a new post in my Microscope app (from Discover Meteor)
Basically it’s in it’s own template and is rendered from the main layout like this:
{{> postButton}}
I want it to be displayed everywhere except on the New Post page itself.
I found Template.registerHelper()
in the Meteor docs, and I found Router.current().route.getName()
in the Iron Route docs, so I registered a global template helper called currentRoute() that basically calls Router.current().route.getName()
and just returns the name of the current route.
I then put this in my main layout file:
{{#if currentRoute() !== 'postCreate'}} ... {{/if}}
This didn’t work, though - it crashed Meteor. Is there a way to check the name of the current route or template from another template and take action based on the outcoe of the test?
Thanks!