From a346bd8064737f82be4dfe1817cf55d0abbf1aa0 Mon Sep 17 00:00:00 2001 From: Nathan Cummins Date: Thu, 15 Oct 2026 17:29:35 +1030 Subject: [PATCH] Slim carousel page weight, with stable per-instance slide IDs --- src/components/ImageCarousel.astro | 26 +++++++++++++------------- src/pages/404.astro | 1 + src/pages/index.astro | 3 +++ src/pages/projects/[type]/[slug].astro | 1 + 4 files changed, 18 insertions(+), 13 deletions(-) diff --git a/src/components/ImageCarousel.astro b/src/components/ImageCarousel.astro index 175c74e..725f7cd 100644 --- a/src/components/ImageCarousel.astro +++ b/src/components/ImageCarousel.astro @@ -6,6 +6,7 @@ import { shuffleArray } from "@lib/utils"; interface Props { images: Array; + id?: string; class: string; altText?: string | ((index: number) => string); interval?: number; @@ -23,6 +24,7 @@ interface Props { const { images, + id = "carousel", class: className, altText = null, interval = 5000, @@ -38,8 +40,6 @@ const { shuffle = false } = Astro.props as Props; -const IDs: string[] = []; - const imagesArray = shuffle ? shuffleArray(images) : images; --- @@ -50,12 +50,9 @@ const imagesArray = shuffle ? shuffleArray(images) : images; { imagesArray.map((image, index) => { - const ID = `image-carousel-${Math.random().toString(36)}`; - IDs.push(ID); - return ( -