Skip to content

Commit 70b6eaf

Browse files
authored
Adding active page styles to the main navigation (#146)
1 parent bcbf853 commit 70b6eaf

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

docs/_includes/primary-navigation.html

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,13 @@
33
<ul class="nhsuk-header__navigation-list">
44

55
{% for p in site.data.primary-navigation -%}
6+
{% assign is_current = false %}
7+
{% if page.url == p.link or page.url contains p.link and p.link != '/' %}
8+
{% assign is_current = true %}
9+
{% endif %}
610
<li class="nhsuk-header__navigation-item">
7-
<a class="nhsuk-header__navigation-link" href="{{ site.baseurl | append: p.link | xml_escape }}">{{ p.title
8-
}}</a>
11+
<a class="nhsuk-header__navigation-link" href="{{ site.baseurl | append: p.link | xml_escape }}" {% if
12+
is_current %} aria-current="page" {% endif %}>{{ p.title }}</a>
913
</li>
1014
{% endfor -%}
1115

0 commit comments

Comments
 (0)