--- import { Image } from 'astro:assets'; interface Props { src: string; alt: string; caption?: string; } const { src, alt, caption } = Astro.props; const images = import.meta.glob<{ default: ImageMetadata }>( '/src/content/**/cover/*.{png,jpg,jpeg,webp,avif}', { eager: true }, ); const imagePath = `/src${src}`; const image = images[imagePath]?.default; ---
{ image ? ( {alt} ) : ( {alt} ) }
{ caption ? ( {caption} ) : ( {src} ) }