Currently we rely on a image with role image to be present as primary image for the ld+json entry and the page metadata:
|
const primaryImage = getPrimaryImage(baseProduct)?.url; |
|
|
|
templateProductData.hasImages = baseProduct.images?.length > 0; |
|
templateProductData.imageList = getImageList(primaryImage, baseProduct.images); |
|
templateProductData.priceString = generatePriceString(baseProduct); |
|
templateProductData.metaDescription = findDescription(baseProduct); |
|
templateProductData.metaImage = primaryImage; |
|
templateProductData.primaryImage = primaryImage; |
and
|
const { name, sku, __typename } = product; |
|
const image = getPrimaryImage(product); |
|
const url = getProductUrl(product, context); |
The logic currently has no fallback, meaning there will be a ld+json with a missing image, which is invalid for a merchant listing.
One option would be to fallback to the first image, if there is none for the given role.
Currently we rely on a image with role
imageto be present as primary image for the ld+json entry and the page metadata:aem-commerce-prerender/actions/pdp-renderer/render.js
Lines 13 to 20 in d855227
and
aem-commerce-prerender/actions/pdp-renderer/ldJson.js
Lines 85 to 87 in d855227
The logic currently has no fallback, meaning there will be a ld+json with a missing image, which is invalid for a merchant listing.
One option would be to fallback to the first image, if there is none for the given role.