feat: store product image URL in window object for improved accessibility in image handling

This commit is contained in:
sebseb7
2025-07-23 08:35:08 +02:00
parent 61faf654bc
commit d16e979771
3 changed files with 6 additions and 4 deletions

View File

@@ -48,6 +48,11 @@ const generateProductMetaTags = (product, baseUrl, config) => {
<!-- Additional Meta Tags --> <!-- Additional Meta Tags -->
<meta name="robots" content="index, follow"> <meta name="robots" content="index, follow">
<link rel="canonical" href="${productUrl}"> <link rel="canonical" href="${productUrl}">
<!-- Store image URL in window object -->
<script>
window.productImageUrl = "${imageUrl}";
</script>
`; `;
}; };

View File

@@ -39,6 +39,7 @@ class Images extends Component {
for(const bildId of bildIds){ for(const bildId of bildIds){
if(bildId == mainPicId){ if(bildId == mainPicId){
if(window.productImageUrl) continue;
if(window.largePicCache[bildId]){ if(window.largePicCache[bildId]){
pics.push(window.largePicCache[bildId]); pics.push(window.largePicCache[bildId]);

View File

@@ -5,8 +5,6 @@ import Images from './Images.js';
const ProductImage = ({ const ProductImage = ({
product, product,
socket,
socketB,
fullscreenOpen, fullscreenOpen,
onOpenFullscreen, onOpenFullscreen,
onCloseFullscreen onCloseFullscreen
@@ -44,8 +42,6 @@ const ProductImage = ({
)} )}
{product.pictureList && ( {product.pictureList && (
<Images <Images
socket={socket}
socketB={socketB}
pictureList={product.pictureList} pictureList={product.pictureList}
productName={product.name} productName={product.name}
fullscreenOpen={fullscreenOpen} fullscreenOpen={fullscreenOpen}