1

i have menu list and i want to add active class on the specific menu item which is clicked e.g if it clicks on contact page then contact option in the menu become active class. I am using NodeJS and Koa here is my code of how iam rendering my marko File `

var contact = function*(){
 this.body = marko.load('./views/contact.marko').stream();
 this.type = 'text/html';
 console.log('At Contact Page');
 }

am using marko as views . and i dont want to use any clientside script

DEO
  • 316
  • 2
  • 4
  • 18

1 Answers1

1

So I trying do this passing the url what is being rendered as an data for the template. something like this:

var contact = function*(){
 this.body = marko.load('./views/contact.marko').stream({url:'/contactpage'});
 this.type = 'text/html';
 console.log('At Contact Page');
 }

and in my template I am trying to compare this url parameter with the menus url and placing the class on then. Not fancy, and still trying make work properly