yufan.me/src/components/image/UnstyledImage.astro

17 lines
301 B
Plaintext

---
import type { Image } from '@/helpers/images';
import { getEntry } from 'astro:content';
interface Props extends Image {
alt: string;
}
let { alt, src } = Astro.props;
if (src.startsWith('/')) {
const image = await getEntry('images', src);
src = image.data.src;
}
---
<img {src} {alt} />