Skip to content

Commit 7384bde

Browse files
committed
Add back to top link
1 parent f0f9923 commit 7384bde

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

layouts/collection-page.njk

+11-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{% extends "./_design-system-base.njk" %}
22

33
{% block skipLink %}
4+
<a id="top"></a>
45
{{ tnaSkipLink({
56
href: 'main-content',
67
text: 'Skip to main content'
@@ -13,10 +14,11 @@
1314

1415
{% block main %}
1516
{% set headings = contents | headingsList %}
17+
{% set topLevel = group|kebabToSpace|capitalize == title|capitalize %}
1618

1719
<div class="tna-container">
1820
<main class="tna-column tna-column--width-3-4 tna-column--width-2-3-medium tna-column--full-small tna-column--full-tiny {{ mainClasses }} tna-section" id="main-content" role="main">
19-
{% if group|kebabToSpace|capitalize == title|capitalize %}
21+
{% if topLevel %}
2022
<h1 class="tna-heading-xl">
2123
{{ title }}
2224
</h1>
@@ -90,5 +92,13 @@
9092
{% endfor %}
9193
</ol>
9294
</nav>
95+
{% if not topLevel %}
96+
<div class="tna-column tna-column--full">
97+
<hr>
98+
<p>
99+
<a href="#top" class="tna-button tna-button--small tna-button--plain"><i class="fa-solid fa-arrow-up"></i>Back to top</a>
100+
</p>
101+
</div>
102+
{% endif %}
93103
</div>
94104
{% endblock %}

0 commit comments

Comments
 (0)