summaryrefslogtreecommitdiff
path: root/themes/24-unification/layouts/_default/comic.html
blob: 1b3efdeb638d9bd2a99bf19efde97a635aa706ac (plain)
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
{{ define "main" }}

{{- $path := .Params.assetPath}}
{{- $img := resources.Get $path }}

{{ $mirror := where .Site.RegularPages ".Params.mirrorName" .Params.mirrorName}}

<nav class="horizontal">
  {{- with $mirror.Next  . }}
    <a href="{{.Permalink}}">[previous]</a>
  {{- end }}

  <a href="/mirror/userfriendly/">[index]</a>

    {{- with $mirror.Prev  . }}
    <a href="{{.Permalink}}">[next]</a>
  {{- end }}
</a>
</nav>

<article>
  <h1 class="comic-title">Comic for
    <time datetime="{{.PublishDate.Format "2006-01-02" }}">
      {{ .PublishDate.Format "Monday, 2 Jan 2006" }}
    </time>
  </h1>
  {{ if gt $img.Width 0 }}
    {{- $img2xproc := printf "x%d gif q90" (math.Mul 2 $img.Height) }}
    {{- $img1x := $img }}
    {{- $img2x := $img.Resize $img2xproc }}
    <figure
      class="centered"
      style="padding: 10px"
      >
      <a href="{{ $img1x.Permalink }}">
        <img 
          src="{{ $img1x.Permalink }}" 
          srcset="
                  {{ $img1x.Permalink }} 1x,
                  {{ $img2x.Permalink }} 2x
                  "
          width="{{ $img1x.Width }}" 
          height="{{ $img1x.Height }}"
          loading="lazy"
          >
      </a>

  {{ else }}
    Corrupted image :-(
  {{ end }}
</article>

<nav class="horizontal">
  {{- with $mirror.Next  . }}
    <a href="{{.Permalink}}">[previous]</a>
  {{- end }}

  <a href="/mirror/userfriendly/">[index]</a>

    {{- with $mirror.Prev  . }}
    <a href="{{.Permalink}}">[next]</a>
  {{- end }}
</a>
</nav>

{{ end }}