From fcace16ee86edc7969bf98de89a15d526c35dcec Mon Sep 17 00:00:00 2001 From: BigCoke233 Date: Mon, 2 Feb 2026 23:26:31 +0800 Subject: perf: book cover loads faster - Transform and compress cover images - Add minimal height to covers, so they don't collapse before loading --- layouts/_partials/items/book.html | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'layouts/_partials') diff --git a/layouts/_partials/items/book.html b/layouts/_partials/items/book.html index 26c7d2d3..5b6e61c2 100644 --- a/layouts/_partials/items/book.html +++ b/layouts/_partials/items/book.html @@ -1,5 +1,19 @@ {{ $ctx := .ctx }} {{ $NoViewTransition := (or .NoViewTransition false) }} + + +{{ $splitURL := split $ctx.Params.cover "/" }} +{{ $cover := "" }} +{{ $i := 0 }} +{{ range $splitURL }} + {{ if eq $i 3 }} + {{ $cover = printf "%s%s" $cover "cdn-cgi/image/width=150,quality=75/" }} + {{ end }} + {{ $cover = printf "%s%s/" $cover . }} + {{ $i = add $i 1 }} +{{ end }} +{{ $cover = strings.TrimSuffix "/" $cover }} + - + {{ if eq $ctx.Params.rating 1 }}