-
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathway-next.html
More file actions
64 lines (56 loc) · 1.91 KB
/
Copy pathway-next.html
File metadata and controls
64 lines (56 loc) · 1.91 KB
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
53
54
55
56
57
58
59
60
61
62
63
64
{% assign tableOfContents = "Table of Contents" %}
{% assign notFound = "Page Not Found" %}
{% assign toc_pages = site.pages | where: "toc", true %}
{% assign pages_sorted = toc_pages | concat: site.ways | sort: 'order' %}
{% assign ways_count = pages_sorted | size %}
{% for way in pages_sorted %}
{% if way.path == page.path %}
{% assign idxp = forloop.index | minus: 1 | minus: 1 %}
{% assign idxn = forloop.index | plus: 1 | minus: 1 %}
{% endif %}
{% if way.title == tableOfContents %}
{% assign idxtoc = forloop.index | minus: 1 %}
{% endif %}
{% endfor %}
{% assign previousLesson = pages_sorted[idxp] %}
{% assign toc = pages_sorted[idxtoc] %}
{% assign nextLesson = pages_sorted[idxn] %}
{% if include.style == "compact" %}
<ul class="way__navigation">
{% if idxp < 0 %}
<li></li>
{% else %}
<li><a href="{{ previousLesson.url | absolute_url }}" title="Previous"></a></li>
{% endif %}
{% unless previousLesson.title == notFound or page.title == tableOfContents %}
<li><a href="{{ toc.url | absolute_url }}" title="{{ toc.title }}">ToC</a></li>
{% endunless %}
{% if idxn >= ways_count %}
<li></li>
{% else %}
<li><a href="{{ nextLesson.url | absolute_url }}" title="Next"></a></li>
{% endif %}
</ul>
{% else %}
<ul class="way__navigation">
{% if idxp < 0 %}
<li></li>
{% else %}
<li><a href="{{ previousLesson.url | absolute_url }}" title="{{ previousLesson.subtitle }}">
{% unless previousLesson.title == tableOfContents %}{{ previousLesson.title }}{% endunless %}
</a></li>
{% endif %}
{% unless previousLesson.title == notFound or page.title == tableOfContents %}
<li><a href="{{ toc.url | absolute_url }}">{{ toc.title }}</a></li>
{% endunless %}
{% if idxn >= ways_count %}
<li></li>
{% else %}
<li>
<a href="{{ nextLesson.url | absolute_url }}" title="{{ nextLesson.subtitle }}">
{{ nextLesson.title }}
</a>
</li>
{% endif %}
</ul>
{% endif %}