I just wrote a post about this. Click here or on the banner:

The basic idea for doing this with a vanilla mustache and NodeJS looks like this:
app.get('/Portfolio', function(req, res) { res.render('portfolio.html', { Portfolio: 'class="current"', }); }); app.get('/Blog', function(req, res) { res.render('blog.html', { Blog: 'class="current"', }); });
Notice how each individual route sends a different mustache variable. If the user goes to / Portfolio, the {{{Portfolio}}} variable will exist, but the {{{Blog}}} variable will not exist.
Using this idea, customize your navigation links as follows:
<div id="nav"> <ul> <li><a href="/Portfolio" {{{ Portfolio }}}>Portfolio</a></li> <li><a href="/Blog" {{{ Blog }}}>Blog</a></li> </ul> </div>
Create a .current class
#nav li a.current { font-weight: 900; }
Now the link will be highlighted depending on the routing call made.
Max mastastz
source share