summaryrefslogtreecommitdiff
path: root/layouts/fictions/section.html
blob: e459ce1d783c8e76f8482c8253dfb15997b9ed9d (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
{{ define "main" }}
    <article>
        {{ partial "header.html" . }}
        <div class="pagefind-exclude">
            <div class="my-8 markdown-body">
            {{ with .Content }}{{ . }}{{ end }}
            </div>
            <div class="flex flex-wrap justify-around gap-8">
                {{- $fictions := .Site.GetPage "section" "fictions" }}
                {{- range $fictions.Pages }}

                {{ $rotationDeg := add (math.Floor (mul (math.Rand) 7)) -4 }}
                {{- $deg := int $rotationDeg -}}
                {{- $rotateClass := cond (ge $deg 0)
                    (printf "rotate-%d" $deg)
                    (printf "-rotate-%d" (mul -1 $deg))
                -}}

                {{ $steps := slice 60 70 80 90 100 }}
                {{ $opacity := index $steps (int (math.Floor (mul (math.Rand) 5))) }}
                {{ $opacityClass := printf "opacity-%d" $opacity }}

                <div class="xerox text-center text-2xl font-extrabold {{ $rotateClass }} {{ $opacityClass }}"
                    style="view-transition-name: post-{{ .File.UniqueID }}">
                    <a href="{{ .Permalink }}">《{{ .Title }}》</a>
                </div>
                {{- end }}
            </div>
        </div>
    </article>
    {{ partial "footer.html" . }}
{{ end }}