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