Highlight active item in nav

master
Emil Miler 2 years ago
parent 5fbb142a03
commit c5274ef031

@ -15,7 +15,7 @@ highlight_code = true
[extra] [extra]
nav_items = [ nav_items = [
{name="Index", path="/"}, {name="Úvod", path="/"},
{name="Projekty", path="/projekty/"}, {name="Projekty", path="/projekty/"},
{name="Kontakty", path="/kontakty/"}, {name="Kontakty", path="/kontakty/"},
] ]

@ -61,7 +61,7 @@ body>nav {
color: #fc0; color: #fc0;
text-decoration: none; text-decoration: none;
&:hover { &:hover, &.active {
background: #131516; background: #131516;
} }
} }

@ -25,7 +25,11 @@
</header> </header>
<nav> <nav>
{% for item in config.extra.nav_items %} {% for item in config.extra.nav_items %}
<a href="{{ item.path }}">{{ item.name }}</a> <a href="{{ item.path }}"
{% if item.path == current_path and item.path != "/" %}
class="active"
{% endif %}
>{{ item.name }}</a>
{% endfor %} {% endfor %}
</nav> </nav>
</body> </body>

Loading…
Cancel
Save