Skip to content

Commit 1e3d49f

Browse files
committed
feat: add attributes to indicate current page in Desktop navbar
1 parent 4ceac17 commit 1e3d49f

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

src/_includes/nav.html

+13-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,19 @@
1717
<ul class="navbar-nav me-auto mb-2 mb-lg-0 d-flex justify-content-end">
1818
{% for nav_item in site.data.nav %}
1919
<li class="nav-item">
20-
<a class="nav-link" href="{{ nav_item.path }}" {% if nav_item.target %} target="{{ nav_item.target }}" {% endif %}
20+
{% assign current_path = page.url | remove:".html" %}
21+
<a
22+
class="nav-link{% if nav_item.path == current_path %} active"
23+
aria-current="page{% endif %}"
24+
href="{{ nav_item.path }}"
25+
{%
26+
if
27+
nav_item.target
28+
%}
29+
target="{{ nav_item.target }}"
30+
{%
31+
endif
32+
%}
2133
>{{ nav_item.name }}</a
2234
>
2335
</li>

0 commit comments

Comments
 (0)