Skip to content

Commit 0925fa9

Browse files
authored
footer next and prev buttons (#171)
1 parent db78803 commit 0925fa9

File tree

2 files changed

+64
-0
lines changed

2 files changed

+64
-0
lines changed

custom_theme/main.html

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,69 @@
141141

142142
{% block footer %}
143143

144+
<div>
145+
<!-- Link to previous and/or next page -->
146+
{% if "navigation.footer" in features %}
147+
{% if page.previous_page or page.next_page %}
148+
{% if page.meta and page.meta.hide %}
149+
{% set hidden = "hidden" if "footer" in page.meta.hide %}
150+
{% endif %}
151+
<nav
152+
class="md-footer__inner md-grid"
153+
aria-label="{{ lang.t('footer') }}"
154+
{{ hidden }}
155+
>
156+
157+
<!-- Link to previous page -->
158+
{% if page.previous_page %}
159+
{% set direction = lang.t("footer.previous") %}
160+
<a
161+
href="{{ page.previous_page.url | url }}"
162+
class="md-footer__link md-footer__link--prev"
163+
aria-label="{{ direction }}: {{ page.previous_page.title | e }}"
164+
>
165+
<div class="md-footer__button md-icon">
166+
{% set icon = config.theme.icon.previous or "material/arrow-left" %}
167+
{% include ".icons/" ~ icon ~ ".svg" %}
168+
</div>
169+
<div class="md-footer__title">
170+
<span class="md-footer__direction">
171+
{{ direction }}
172+
</span>
173+
<div class="md-ellipsis">
174+
{{ page.previous_page.title }}
175+
</div>
176+
</div>
177+
</a>
178+
{% endif %}
179+
180+
<!-- Link to next page -->
181+
{% if page.next_page %}
182+
{% set direction = lang.t("footer.next") %}
183+
<a
184+
href="{{ page.next_page.url | url }}"
185+
class="md-footer__link md-footer__link--next"
186+
aria-label="{{ direction }}: {{ page.next_page.title | e }}"
187+
>
188+
<div class="md-footer__title">
189+
<span class="md-footer__direction">
190+
{{ direction }}
191+
</span>
192+
<div class="md-ellipsis">
193+
{{ page.next_page.title }}
194+
</div>
195+
</div>
196+
<div class="md-footer__button md-icon">
197+
{% set icon = config.theme.icon.next or "material/arrow-right" %}
198+
{% include ".icons/" ~ icon ~ ".svg" %}
199+
</div>
200+
</a>
201+
{% endif %}
202+
</nav>
203+
{% endif %}
204+
{% endif %}
205+
</div>
206+
144207
<footer class="footer">
145208
<div class="tmp-container">
146209

mkdocs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ theme:
1414
- navigation.tabs
1515
- navigation.path
1616
- navigation.indexes
17+
- navigation.footer
1718
- search.suggest
1819
- search.suggest
1920
- content.code.copy

0 commit comments

Comments
 (0)