Prepend "./src" if not present

This commit is contained in:
madrilene 2025-01-10 12:44:22 +01:00
parent 78fb47cd01
commit f029a43a8e

View file

@ -21,6 +21,11 @@ export const imageShortcode = async (
sizes = 'auto',
formats = ['avif', 'webp', 'jpeg']
) => {
// Prepend "./src" if not present
if (!src.startsWith('./src')) {
src = `./src${src}`;
}
const metadata = await Image(src, {
widths: [...widths],
formats: [...formats],