summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEltrac <hi@guhub.cn>2025-11-06 11:01:00 +0800
committerEltrac <hi@guhub.cn>2025-11-06 11:01:00 +0800
commit52f703d9e73a1b55b31e24609ee16030e2f8eda6 (patch)
treed507beff6b37ba7ce0e6a47587f748551b9d31dd
parent1fafbca42b787fa00767f7170666c24dd768a6da (diff)
fix: duplicated view transition names in library page
Former-commit-id: 8983b2a48d16bc763f5181bb974ee73efbcaafff
-rw-r--r--layouts/_partials/items/book.html15
-rw-r--r--layouts/_partials/term/term-books.html2
-rw-r--r--layouts/library/page.html4
-rw-r--r--layouts/library/section.html11
-rw-r--r--layouts/library/yearlist.html3
5 files changed, 24 insertions, 11 deletions
diff --git a/layouts/_partials/items/book.html b/layouts/_partials/items/book.html
index dca2961b..5a8c8efd 100644
--- a/layouts/_partials/items/book.html
+++ b/layouts/_partials/items/book.html
@@ -1,14 +1,17 @@
+{{ $ctx := .ctx }}
+{{ $NoViewTransition := (or .NoViewTransition false) }}
<div{{ if eq .Params.rating 1 }} class="opacity-50 z-0"{{ end }}
- style="view-transition-name: book-{{ .File.UniqueID }}">
- <a href="{{ .Permalink }}" style="view-transition-name: book-{{ .Title }}"
+ {{ if not $NoViewTransition }}style="view-transition-name: book-{{ $ctx.File.UniqueID }}"{{ end }}>
+ <a href="{{ $ctx.Permalink }}"
+ {{ if not $NoViewTransition }}style="view-transition-name: book-{{ $ctx.Title }}"{{ end }}
class="border-3 border-solid rotate-3 shadow-md block
hover:rotate-0 hover:-translate-y-2 hover:scale-110 transition
- {{ if eq .Params.rating 1 }} relative
- {{ else if eq .Params.rating 5 }} border-amber-200 shadow-amber-100
+ {{ if eq $ctx.Params.rating 1 }} relative
+ {{ else if eq $ctx.Params.rating 5 }} border-amber-200 shadow-amber-100
{{ else }} border-white{{ end }}">
- <img class="lazy w-full block" src="{{ .Params.cover }}!small" />
- {{ if eq .Params.rating 1 }}
+ <img class="lazy w-full block" src="{{ $ctx.Params.cover }}!small" />
+ {{ if eq $ctx.Params.rating 1 }}
<div class="absolute z-1 top-[25%] left-[25%] h-[50%] w-[50%]"
style="background-image: url('https://image.guhub.cn/uPic/2025/05/thumbs-down.png');
background-size: 100%;
diff --git a/layouts/_partials/term/term-books.html b/layouts/_partials/term/term-books.html
index 5af0a77a..2bd48295 100644
--- a/layouts/_partials/term/term-books.html
+++ b/layouts/_partials/term/term-books.html
@@ -3,7 +3,7 @@
<h2>{{ T "termPage.books" }}</h2>
<div class="grid grid-cols-4 md:grid-cols-6 items-center gap-4 my-4">
{{ range $books }}
- {{ partial "items/book" . }}
+ {{ partial "items/book" (dict "ctx" .) }}
{{ end }}
</div>
{{ end }}
diff --git a/layouts/library/page.html b/layouts/library/page.html
index bcd36854..df2192de 100644
--- a/layouts/library/page.html
+++ b/layouts/library/page.html
@@ -49,7 +49,9 @@
<div class="grid grid-cols-4 md:grid-cols-6 items-center gap-4 my-4">
{{ range $books }}
{{ if ne .File.UniqueID $thisBookID }}
- <div data-tooltip="{{ .Title }}">{{ partial "items/book" . }}</div>
+ <div data-tooltip="{{ .Title }}">
+ {{ partial "items/book" (dict "ctx" .) }}
+ </div>
{{ end }}
{{ end }}
</div>
diff --git a/layouts/library/section.html b/layouts/library/section.html
index 973c6351..a7df419a 100644
--- a/layouts/library/section.html
+++ b/layouts/library/section.html
@@ -14,7 +14,9 @@
{{ range $i, $book := $first18BooksThisYear }}
<div class="{{ if gt $i 15 }}hidden md:block{{ end }}"
data-tooltip="{{ $book.Title }}">
- {{ partial "items/book" $book }}
+ {{ partial "items/book" (dict
+ "ctx" $book
+ ) }}
</div>
{{ end }}
</div>
@@ -47,7 +49,12 @@
)}}
<div class="grid grid-cols-4 md:grid-cols-6 items-center gap-4 my-4">
{{ range $goodBooks }}
- <div data-tooltip="{{ .Title }}">{{ partial "items/book" . }}</div>
+ <div data-tooltip="{{ .Title }}">
+ {{ partial "items/book" (dict
+ "ctx" .
+ "NoViewTransition" true
+ ) }}
+ </div>
{{ end }}
</div>
</div>
diff --git a/layouts/library/yearlist.html b/layouts/library/yearlist.html
index 8250046d..1405cb27 100644
--- a/layouts/library/yearlist.html
+++ b/layouts/library/yearlist.html
@@ -7,7 +7,8 @@
{{ $year := .Title }}
{{ range where .Site.RegularPages "Section" "library" }}
{{ if eq (printf "%d" .Date.Year) $year }}
- <div data-tooltip="{{ .Title }}">{{ partial "items/book" . }}</div>
+ <div data-tooltip="{{ .Title }}">
+ {{ partial "items/book" (dict "ctx" .) }}</div>
{{ end }}
{{ end }}
</div>