File tree 1 file changed +41
-0
lines changed
1 file changed +41
-0
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,47 @@ <h1 class="title">{{ page.title }}{% if page.subtitle %} <span class="subtitle">
7
7
8
8
{{ content }}
9
9
10
+ {% comment %}
11
+ From https://talk.jekyllrb.com/t/previous-and-next-links-with-a-collections/3171
12
+ {% endcomment %}
13
+ {% assign items_raw = site.lectures %}
14
+ {% assign items = items_raw | sort: 'number' | reverse %}
15
+
16
+ {% if items.size > 1 %}
17
+ {% comment %}
18
+ Store the index position of the matching items
19
+ {% endcomment %}
20
+ {% for item in items %}
21
+ {% if item.title == page.title %}
22
+ {% assign item_index = forloop.index %}
23
+ {% endif %}
24
+ {% endfor %}
25
+
26
+ {% assign prev_index = item_index | plus: 1 %}
27
+ {% assign next_index = item_index | minus: 1 %}
28
+
29
+ {% for item in items %}
30
+ {% if forloop.index == prev_index %}
31
+ {% assign prev = item %}
32
+ {% endif %}
33
+ {% if forloop.index == next_index %}
34
+ {% assign next = item %}
35
+ {% endif %}
36
+ {% endfor %}
37
+
38
+ < p >
39
+ {% if prev %}
40
+ < a href ="{{ site.baseurl}}{{ prev.url }} " class ="prev " title ="{{ prev.title }} "> < Previous</ a >
41
+ {% endif %}
42
+ {% if prev and next %}
43
+ < span > | </ span >
44
+ {% endif %}
45
+ {% if next %}
46
+ < a href ="{{ site.baseurl }}{{ next.url }} " class ="next " title ="{{ next.title }} "> Next ></ a >
47
+ {% endif %}
48
+ </ p >
49
+ {% endif %}
50
+
10
51
< hr >
11
52
12
53
< div class ="small center ">
You can’t perform that action at this time.
0 commit comments