I have come up with the following code but the problem is, there will be duplication of the anchor tag for each menu item.Is there a better way to do this?
You can pass the pageName in the data.
each menu in ["Home", "Dashboard", "Contact", "About"]
if (menu == pageName)
li.active
a(href="/#{menu}")= menu
else
li
a(href="/#{menu}")= menu
You can call render
res.render("index", { pageName: 'Home'})
res.render("index", { pageName: 'Dashboard'})
res.render("index", { pageName: 'Contact'})