Answer the question
In order to leave comments, you need to log in
How to specify a condition for a link in PUG?
Good afternoon, please tell me how in PUG to make the href="index.html" attribute of the link appear only when there is a variable on the page - var pageClass = 'index-page', otherwise the link should not be href ?
I only managed to implement it this way, but it doesn’t quite suit me, it turns out extra repetitive code. Is there any way to reduce this code? Thanks in advance for your reply)
if pageClass !== 'index-page'
a(href='index.html').main-nav__logo
else
a.main-nav__logo
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question