Add aria-current if on the current page

This commit is contained in:
Helen Chong 2024-04-17 00:19:15 +08:00
parent 8c4e5b1e41
commit 13f27458d7
1 changed files with 7 additions and 1 deletions

View File

@ -1,7 +1,13 @@
{% set currentUrl %}{{ page.url }}{% endset %}
<nav class="navbar">
<ul class="nav__menu">
{% for page in collections.pages %}
<li><a href="{{ page.url }}">{{ page.data.title or page.data.metadata.title }}</a></li>
<li>
<a href="{{ page.url }}" {% if currentUrl === page.url %}aria-current="page"{% endif %}>
{{ page.data.title or page.data.metadata.title }}
</a>
</li>
{%- endfor %}
<li><a href="https://leilukin.123guestbook.com/">Guestbook</a></li>
</ul>