-
Notifications
You must be signed in to change notification settings - Fork 67
Expand file tree
/
Copy pathprev-next-pages.html
More file actions
52 lines (46 loc) · 1.98 KB
/
prev-next-pages.html
File metadata and controls
52 lines (46 loc) · 1.98 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
<div class="gd-docs-prev-next-pages">
<div class="gd-docs-prev-next-pages__wrapper">
{{ template "find-prev" (dict "currentPage" . ) }}
</div>
<div class="gd-docs-prev-next-pages__wrapper">
{{ template "find-next" (dict "currentPage" . ) }}
</div>
</div>
{{ define "find-prev" }}
{{ $currentPage := .currentPage }}
{{ if $currentPage.IsSection }}
{{ else }}
{{ if $currentPage.NextInSection }}
{{ with $currentPage.NextInSection }}
<a href="{{ .RelPermalink }}" class="gd-docs-prev-next-pages__link gd-docs-prev-next-pages__prev" aria-label="{{ .LinkTitle }} (Prev article)">
<span class="gd-docs-prev-next-pages__chevron">{{ with resources.Get "icons/chevron.svg" }}{{ ( . | minify).Content | safeHTML }}{{ end }}</span>
{{ .LinkTitle }}
</a>
{{ end }}
{{ else }}
<!-- TODO: Find prev section -->
{{ end }}
{{ end }}
{{ end }}
{{ define "find-next" }}
{{ $currentPage := .currentPage }}
{{ if $currentPage.IsSection }}
{{ with index $currentPage.Pages.ByWeight 0 }}
<a href="{{ .RelPermalink }}" class="gd-docs-prev-next-pages__link gd-docs-prev-next-pages__next" aria-label="{{ .LinkTitle }} (Next article)">
<span class="gd-docs-prev-next-pages__chevron">{{ with resources.Get "icons/chevron.svg" }}{{ ( . | minify).Content | safeHTML }}{{ end }}</span>
{{ .LinkTitle }}
</a>
{{ end }}
{{ else }}
{{ if $currentPage.PrevInSection }}
{{ with $currentPage.PrevInSection }}
<a href="{{ $currentPage.PrevInSection.RelPermalink }}" class="gd-docs-prev-next-pages__link gd-docs-prev-next-pages__next" aria-label="{{ .LinkTitle }} (Next article)">
<span class="gd-docs-prev-next-pages__chevron">{{ with resources.Get "icons/chevron.svg" }}{{ ( . | minify).Content | safeHTML }}{{ end }}</span>
{{ $currentPage.PrevInSection.LinkTitle }}
</a>
{{ end }}
{{ else }}
<!-- TODO: Find next section -->
{{ end }}
{{ end }}
{{ end }}