Highlight active item in nav

master
Emil Miler 2 years ago
parent 5fbb142a03
commit c5274ef031

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

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

@ -25,7 +25,11 @@
</header>
<nav>
{% 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 %}
</nav>
</body>

Loading…
Cancel
Save