summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoreltrac <hi@eltr.ac>2026-05-13 15:17:07 +0800
committereltrac <hi@eltr.ac>2026-05-13 15:17:07 +0800
commit8479438d1d10e1466558adecbfa258d9bb09a74d (patch)
treef5aa8ec18a014de09d61861a9063a8ad805c0797
parent651b4e502d59041e6f5d5fca10a4cc9bd7f00309 (diff)
refactor(section/fiction): view_item.html
-rw-r--r--layouts/fiction/section.html15
-rw-r--r--layouts/fiction/view_item.html13
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>