-
Notifications
You must be signed in to change notification settings - Fork 82
/
Copy pathsu2gui_section_nav.html
52 lines (49 loc) · 1.71 KB
/
su2gui_section_nav.html
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
{% comment %}
Map grabs the doc sections, giving us an array of arrays. Join, flattens all
the items to a comma delimited string. Split turns it into an array again.
{% endcomment %}
{% assign su2gui = site.data.su2gui | map: 'su2gui' | join: ',' | split: ',' %}
{% comment %}
Because this is built for every page, lets find where we are in the ordered
document list by comparing url strings. Then if there's something previous or
next, lets build a link to it.
{% endcomment %}
{% for document in su2gui %}
{% assign document_url = document | prepend:"/su2gui/" | append:"/" %}
{% if document_url == page.url %}
<ul class="pager">
{% if forloop.first %}
<li class="previous disabled">
<a>
<span aria-hidden="true">←</span> Previous
</a>
</li>
{% else %}
{% assign previous = forloop.index0 | minus: 1 %}
{% assign previous_page = su2gui[previous] | prepend:"/su2gui/" | append:"/" %}
<li class="previous">
<a href="{{ previous_page | relative_url }}">
<span aria-hidden="true">←</span> Previous
</a>
</li>
{% endif %}
{% if forloop.last %}
<li class="next disabled">
<a>
Next <span aria-hidden="true">→</span>
</a>
</li>
{% else %}
{% assign next = forloop.index0 | plus: 1 %}
{% assign next_page = su2gui[next] | prepend:"/su2gui/" | append:"/" %}
<li class="next">
<a href="{{ next_page | relative_url }}">
Next <span aria-hidden="true">→</span>
</a>
</li>
{% endif %}
</div>
<div class="clear"></div>
{% break %}
{% endif %}
{% endfor %}