about summary refs log tree commit diff
path: root/layouts/partials/comicNav.html
blob: 2d8eeaca4b4a75ea4dbfdbcaa8e4c9fba947d0ea (plain) (blame)
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
{{ $comics := ($.Site.GetPage "section" .Section).Pages.ByPublishDate }}
{{ $random := (shuffle (where (where .Site.RegularPages "Section" "comics") "Title" "!=" .Title )) }}

{{ if (eq .PrevInSection nil) }}
    <button disabled> First </button>
    <button disabled> Prev </button>
{{ end }}

{{ with .PrevInSection }}
  {{ range first 1 $comics }}
    <a href="{{ .Permalink }}">
      <button> First </button>
    </a>
  {{ end }}
  <a href="{{ .Permalink }}">
    <button> Prev </button>
  </a>
{{ end }}

{{ range first 1 $random }}
<a href="{{.Permalink}}">
  <button> Random </button>
</a>
{{ end }}

{{ with .NextInSection }}
  <a href="{{ .Permalink }}">
    <button> Next </button>
  </a>

  {{ range last 1 $comics }}
    <a href="{{ .Permalink }}">
      <button> Last </button>
    </a>
  {{ end }}
{{ end }}
{{ if (eq .NextInSection nil) }}
    <button disabled> Next </button>
    <button disabled> Last </button>
{{ end }}