-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfooter_custom.html
More file actions
82 lines (69 loc) · 3.05 KB
/
footer_custom.html
File metadata and controls
82 lines (69 loc) · 3.05 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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
{%- assign nav_pages = site.html_pages
| where_exp: "item", "item.title != nil"
| where_exp: "item", "item.nav_exclude != true" -%}
{%- assign nav_top_nodes = nav_pages
| where_exp: "item", "item.parent == nil" -%}
{%- include components/nav/sorted.html pages=nav_top_nodes -%}
{%- assign pager_pages = "" | split: "" -%}
{%- for top_node in nav_sorted -%}
{%- assign pager_pages = pager_pages | push: top_node -%}
{%- assign child_pages = nav_pages | where: "parent", top_node.title -%}
{%- include components/nav/sorted.html pages=child_pages -%}
{%- assign child_pages = nav_sorted -%}
{%- if top_node.child_nav_order == 'desc' or top_node.child_nav_order == 'reversed' -%}
{%- assign child_pages = child_pages | reverse -%}
{%- endif -%}
{%- for child_page in child_pages -%}
{%- assign pager_pages = pager_pages | push: child_page -%}
{%- assign grandchild_pages = nav_pages | where: "parent", child_page.title -%}
{%- include components/nav/sorted.html pages=grandchild_pages -%}
{%- assign grandchild_pages = nav_sorted -%}
{%- if child_page.child_nav_order == 'desc' or child_page.child_nav_order == 'reversed' -%}
{%- assign grandchild_pages = grandchild_pages | reverse -%}
{%- endif -%}
{%- assign pager_pages = pager_pages | concat: grandchild_pages -%}
{%- endfor -%}
{%- endfor -%}
{%- assign current_index = -1 -%}
{%- for pager_page in pager_pages -%}
{%- if pager_page.url == page.url -%}
{%- assign current_index = forloop.index0 -%}
{%- break -%}
{%- endif -%}
{%- endfor -%}
{%- if current_index >= 0 -%}
{%- assign previous_page = nil -%}
{%- assign next_page = nil -%}
{%- assign current_children = nav_pages | where: "parent", page.title | sort_natural: "title" | sort: "nav_order" -%}
{%- if current_index > 0 -%}
{%- assign previous_index = current_index | minus: 1 -%}
{%- assign previous_page = pager_pages[previous_index] -%}
{%- endif -%}
{%- assign pager_count = pager_pages | size -%}
{%- assign last_index = pager_count | minus: 1 -%}
{%- if current_index < last_index -%}
{%- assign next_index = current_index | plus: 1 -%}
{%- assign next_page = pager_pages[next_index] -%}
{%- endif -%}
{%- if page.has_children and current_children.size > 0 -%}
{%- assign next_page = current_children.first -%}
{%- endif -%}
{%- if previous_page or next_page -%}
<nav class="page-nav" aria-label="Page navigation">
{%- if previous_page -%}
<a class="page-nav-link page-nav-link-prev" href="{{ previous_page.url | relative_url }}">
<span class="page-nav-label">Previous</span>
<span class="page-nav-title">{{ previous_page.title }}</span>
</a>
{%- else -%}
<span></span>
{%- endif -%}
{%- if next_page -%}
<a class="page-nav-link page-nav-link-next" href="{{ next_page.url | relative_url }}">
<span class="page-nav-label">Next</span>
<span class="page-nav-title">{{ next_page.title }}</span>
</a>
{%- endif -%}
</nav>
{%- endif -%}
{%- endif -%}