V
V
Vadim Somov2017-09-07 23:09:21
HTML
Vadim Somov, 2017-09-07 23:09:21

How to do this in pug?

Hello everyone, I'm learning pug. When laying out the menu, I wanted to feel the possibilities of pug and did this: I went through an array with text and blinded the layout . And now I don’t know how best to do it in order to hang up the .active class, which will show that you are on this page? And hang different links for each element? Now there just hangs vk.com.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Z
zooks, 2017-09-08
@zooks

-var selected = 'home';
ul
  each val, key in menu
    li
      if selected === key
        a.selected(href=val, title=key)= key
      else
        a(href=val, title=key)= key

https://stackoverflow.com/questions/15719660/jade-...
And for links, make an object instead of an array.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question