Recently, I implement Express-Handlebars and with it, came a problem: I can't seem to be able to set my current navigation bar to active. I've looked into tons of posts but it either doesn't work (maybe I'm doing something wrong?) or it is not the Handlebars I'm using.
Here is my current code, taken from an online tutorial:
Header.hbs:
<ul class="nav navbar-nav navbar-right">
<li class="nav-item {{#if active.Register}}active{{/if}}" class="navbar-right">
<a class="nav-link" href="/Register">Register</a>
</li>
<li class="nav-item {{#if active.Login}}active{{/if}}" class="navbar-right">
<a class="nav-link" href="/Login">Login</a>
</li>
</ul>
routes:
app.get('/Login', function(req, res) {
res.render('Login', { title: "Login"});
});
app.get('/Register', function(req, res) {
res.render('Register', { title: "Register"});
});
Any tips would be greatly appreciated! Thanks!