From aa07ebc3b020a02557494d74ac87be21cfbc57e3 Mon Sep 17 00:00:00 2001 From: Alexander Bocken Date: Thu, 26 Feb 2026 19:49:10 +0100 Subject: [PATCH] recipes: preload hero images with high priority Add fetchpriority="high" and hints to hero images on both the recipe listing and detail pages. Also prefetch the full-size hero image on card hover via new Image() to warm the cache before navigation. --- src/lib/components/recipes/Card.svelte | 6 +++++- src/lib/components/recipes/TitleImgParallax.svelte | 2 +- src/routes/[recipeLang=recipeLang]/+page.svelte | 4 ++++ src/routes/[recipeLang=recipeLang]/[name]/+page.svelte | 1 + 4 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/lib/components/recipes/Card.svelte b/src/lib/components/recipes/Card.svelte index dc3bc40..20a6aad 100644 --- a/src/lib/components/recipes/Card.svelte +++ b/src/lib/components/recipes/Card.svelte @@ -38,6 +38,10 @@ const img_alt = $derived( ); const img_color = $derived(recipe.images?.[0]?.color || ''); + +function preloadHeroImage() { + new Image().src = `https://bocken.org/static/rezepte/full/${img_name}`; +}
- + View recipe: {recipe.name}
diff --git a/src/lib/components/recipes/TitleImgParallax.svelte b/src/lib/components/recipes/TitleImgParallax.svelte index 1d5816b..594ba33 100644 --- a/src/lib/components/recipes/TitleImgParallax.svelte +++ b/src/lib/components/recipes/TitleImgParallax.svelte @@ -145,7 +145,7 @@ dialog button{
- +