diff options
| -rw-r--r-- | layouts/fiction/section.html | 15 | ||||
| -rw-r--r-- | layouts/fiction/view_item.html | 13 |
2 files changed, 14 insertions, 14 deletions
diff --git a/layouts/fiction/section.html b/layouts/fiction/section.html index 9bbf122..a025f11 100644 --- a/layouts/fiction/section.html +++ b/layouts/fiction/section.html @@ -4,20 +4,7 @@ <div class="pagefind-exclude my-8"> <div class="flex flex-wrap justify-around gap-8"> {{- range .Pages }} - - {{ $rotationDeg := add (math.Floor (mul (math.Rand) 7)) -4 }} - {{- $deg := int $rotationDeg -}} - - {{ $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 - {{ $opacityClass }} - transition hover:opacity-100 hover:scale-110" - style="view-transition-name: post-{{ .File.UniqueID }}; {{ if ne $deg 0 }}--rotation-deg: {{ $deg }}deg; transform: rotate({{ $deg }}deg);{{ end }}"> - <a class="hover:no-underline" href="{{ .Permalink }}">《{{ .Title }}》</a> - </div> + {{ .Render "view_item" }} {{- end }} </div> </div> diff --git a/layouts/fiction/view_item.html b/layouts/fiction/view_item.html new file mode 100644 index 0000000..30c0505 --- /dev/null +++ b/layouts/fiction/view_item.html @@ -0,0 +1,13 @@ +{{ $rotationDeg := add (math.Floor (mul (math.Rand) 7)) -4 }} +{{- $deg := int $rotationDeg -}} + +{{ $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 + {{ $opacityClass }} + transition hover:opacity-100 hover:scale-110" + style="view-transition-name: post-{{ .File.UniqueID }}; {{ if ne $deg 0 }}--rotation-deg: {{ $deg }}deg; transform: rotate({{ $deg }}deg);{{ end }}"> + <a class="hover:no-underline" href="{{ .Permalink }}">《{{ .Title }}》</a> +</div> |
