Skip to content

Commit 8c17b78

Browse files
committed
Add custom prev-next option
Checks page for `prev_link`/`next_link` and `prev_title`/`next_title` first, to allow for custom prev/next links. This also allow for custom titles, which, while not yet utilized, can be useful in situations such as shortening a long page title's link. Enabled on two pages, to address issue with container only path leading to an LmP content page, and for fioctl to point back to getting started, rather than an LmP content page. Checked running a local server instance for correct rendering and links. This commit applies to issue FFTK-4720, "…Getting Started flow…" This commit applies to issue FFTK-4681, "…Customizable prev/next…" Signed-off-by: Katrina Prosise <katrina.prosise@foundries.io>
1 parent cfd5920 commit 8c17b78

4 files changed

Lines changed: 35 additions & 13 deletions

File tree

source/_templates/prev-next.html

Lines changed: 26 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,26 @@
1-
{%- if (show_prev_next == 'true') and (next or prev) %}
2-
{#- Translators: This is an ARIA section label for the footer section of the page. -#}
3-
<div class="rst-footer-buttons" role="navigation" aria-label="{{ _('Footer') }}">
4-
{%- if prev %}
5-
<a href="{{ prev.link|e }}" class="btn btn-neutral float-left" title="{{ prev.title|striptags|e }}" accesskey="p" rel="prev" data-analytics-event="cta" data-analytics-action="click" data-analytics-label="previous" data-analytics-detail="{{ prev.title|striptags|e }}" data-analytics-location="{{ prev.link|e }}"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> {{ _('Previous') }}</a>
6-
{%- endif %}
7-
{%- if next %}
8-
<a href="{{ next.link|e }}" class="btn btn-neutral float-right" title="{{ next.title|striptags|e }}" accesskey="n" rel="next" data-analytics-event="cta" data-analytics-action="click" data-analytics-label="next" data-analytics-detail="{{ next.title|striptags|e }}" data-analytics-location="{{ next.link|e }}">{{ _('Next') }} <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
9-
{%- endif %}
10-
</div>
11-
{%- endif %}
12-
13-
<hr/>
1+
{# Modified version of PyData's prev-next, checks page metadata for custom links first #}
2+
{# Displays links to the previous and next page in the TOCtree order. #}
3+
<div class="prev-next-area">
4+
{%- if prev %}
5+
<a class="left-prev"
6+
href="{{ meta.prev_link or prev.link|e }}"
7+
title="{{ _('previous page') }}">
8+
<i class="fa-solid fa-angle-left"></i>
9+
<div class="prev-next-info">
10+
<p class="prev-next-subtitle">{{ _("previous") }}</p>
11+
<p class="prev-next-title">{{ meta.prev_title or prev.title }}</p>
12+
</div>
13+
</a>
14+
{%- endif %}
15+
{%- if next %}
16+
<a class="right-next"
17+
href="{{ meta.next_link or next.link|e }}"
18+
title="{{ _('next page') }}">
19+
<div class="prev-next-info">
20+
<p class="prev-next-subtitle">{{ _("next") }}</p>
21+
<p class="prev-next-title">{{ meta.next_title or next.title }}</p>
22+
</div>
23+
<i class="fa-solid fa-angle-right"></i>
24+
</a>
25+
{%- endif %}
26+
</div>

source/conf.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,7 @@
276276
'navbar_persistent': [],
277277
'navbar_end': ['version-switcher', 'theme-switcher', 'navbar-icon-links'],
278278
'secondary_sidebar_items': ['page-toc', 'book-demo'],
279+
'show_prev_next': False, # turn off default theme
279280
'article_footer_items': ['prev-next'],
280281
'content_footer_items': [],
281282
'footer_start':['copyright'],

source/getting-started/fioup-registration/index.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
:next_link: ../install-fioctl/index.html
2+
3+
:next_title: Installing Fioctl
4+
15
Registering Your Device with Fioup
26
==================================
37

source/getting-started/install-fioctl/index.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
:prev_link: ../index.html
2+
3+
:prev_title: Getting Started
4+
15
.. _gs-install-fioctl:
26

37
Installing Fioctl

0 commit comments

Comments
 (0)