How to evaluate this condition?

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?


Yeah spacebars doesn’t like logical operations so you have to DIY.
Short of doing a custom helper for every logic condition, you can do something like this:

Thanks. Eventually someone will invent a better solution. But until then, that works for now.