Hey,
I’m trying to add a conditional class on url in a navigation. It’s working well for pages inside the root, but not for pages inside folders. This is my code so far:
{% for item in site.data.nav %}
<li class="{% if item.link == page.url %}active{% endif %}">
<a href="{{ item.link }}">{{ item.title }}</a>
</li>
{% endfor %}
I’d like to have this class active on one link of this list (the one corresponding to the folder). I tried that:
<li class="{% if item.link == page.url %}active {% elsif page.layout == 'projects'%}active{% endif %}">
But it put the class on every items of the list.
Does someone has a solution?
Thank you!