#๐ Content collections for small e-catalog with no backend
14 messages ยท Page 1 of 1 (latest)
you could set details like product name, price, image in a schema, and astro will make sure all entries include all that information
no need in schema right now. if only for practice new astro stuff
but there is one a big small problems - using <Image />
is it good?
const getProductImagesByCode = (code) => {
const images = import.meta.glob("/src/images/product/*", { eager: true });
const imagesProps = Object.values(images).map((image) => image.default);
const imagesFiltered = imagesProps.filter((image) => image.src.includes(code));
return imagesFiltered;
}
export default getProductImagesByCode;
im getting image(-s) by product's code and use them for <Image />
any better solution?