diff --git a/src/components/Card.astro b/src/components/Card.astro index 75a7586..ef26099 100644 --- a/src/components/Card.astro +++ b/src/components/Card.astro @@ -15,8 +15,11 @@ const { imageClass } = Astro.props const images = import.meta.glob<{ default: ImageMetadata }>('/src/assets/*.{jpeg,jpg,png,gif}') -if (!images[imagePath]) - throw new Error(`"${imagePath}" does not exist in glob: "src/assets/*.{jpeg,jpg,png,gif}"`) + +if (imagePath) { + if (!images[imagePath]) + throw new Error(`"${imagePath}" does not exist in glob: "src/assets/*.{jpeg,jpg,png,gif}"`) +} --- - {altText} + { + imagePath && ( + {altText} + ) + }

{heading}