-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathcontents-list.html
More file actions
25 lines (22 loc) · 904 Bytes
/
contents-list.html
File metadata and controls
25 lines (22 loc) · 904 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
{%- comment -%}
NHS Contents List Component
Used for mini-hub navigation
Parameters:
- items: array of objects with 'title', 'url', and optional 'current' (boolean)
Example usage:
{% include components/contents-list.html items=page.mini_hub_pages %}
{%- endcomment -%}
<nav class="nhsuk-contents-list" role="navigation" aria-label="Pages in this guide">
<h2 class="nhsuk-u-visually-hidden">Contents</h2>
<ol class="nhsuk-contents-list__list">
{% for item in include.items %}
<li class="nhsuk-contents-list__item{% if item.current %} nhsuk-contents-list__item--current{% endif %}">
{% if item.current %}
<span class="nhsuk-contents-list__current" aria-current="page">{{ item.title }}</span>
{% else %}
<a class="nhsuk-contents-list__link" href="{{ item.url | prepend: site.baseurl }}">{{ item.title }}</a>
{% endif %}
</li>
{% endfor %}
</ol>
</nav>