Skip to content

Commit

Permalink
add alt to preload images for SEO crawlers
Browse files Browse the repository at this point in the history
  • Loading branch information
noam-heller1 committed Mar 5, 2024
1 parent 523feca commit 2709e87
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions packages/gallery/src/components/item/imageItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ class ImageItem extends React.Component {

const image = () => {
const imagesComponents = [];
const altText = typeof alt === 'string' ? alt : 'untitled image';
const blockDownloadStyles =
utils.isMobile() && this.props.options[optionsMap.behaviourParams.gallery.blockContextMenu]
? {
Expand Down Expand Up @@ -146,7 +147,7 @@ class ImageItem extends React.Component {
case GALLERY_CONSTS[optionsMap.behaviourParams.item.content.loader].BLUR:
preload = (
<ImageRenderer
alt=""
alt={altText}
key={'image_preload_blur-' + id}
src={createUrl(GALLERY_CONSTS.urlSizes.RESIZED, GALLERY_CONSTS.urlTypes.LOW_RES)}
style={{
Expand All @@ -162,7 +163,7 @@ class ImageItem extends React.Component {
case GALLERY_CONSTS[optionsMap.behaviourParams.item.content.loader].MAIN_COLOR:
preload = (
<ImageRenderer
alt=""
alt={altText}
key={'image_preload_main_color-' + id}
src={createUrl(GALLERY_CONSTS.urlSizes.PIXEL, GALLERY_CONSTS.urlTypes.HIGH_RES)}
style={{
Expand Down Expand Up @@ -195,7 +196,7 @@ class ImageItem extends React.Component {
data-hook="gallery-item-image-img"
data-idx={idx}
src={src}
alt={typeof alt === 'string' ? alt : 'untitled image'}
alt={altText}
tabIndex="0"
onLoad={this.handleHighResImageLoad}
loading={this.props.isPrerenderMode ? 'lazy' : 'eager'}
Expand Down

0 comments on commit 2709e87

Please sign in to comment.