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?
Very flexible without duplication:
ul
each menuitem in [{title:'Home',url:'/'},{title:'About',url:'/about'},{title:'Contact',url:'/contact'}]
if (menuitem.title == title)
li.active
a.active(href=menuitem.url) #{menuitem.title}
else
li
a(href=menuitem.url) #{menuitem.title}
You need to set the page's current title.