Skip to content

Commit b9fb578

Browse files
committed
ACP2E-2266: add itemprop for main image
1 parent f007b9a commit b9fb578

File tree

7 files changed

+9
-81
lines changed

7 files changed

+9
-81
lines changed

app/code/Magento/Catalog/view/frontend/layout/catalog_product_view.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
<css src="mage/gallery/gallery.css"/>
1111
</head>
1212
<update handle="catalog_product_opengraph" />
13-
<update handle="catalog_product_microdata" />
1413
<update handle="page_calendar"/>
1514
<body>
1615
<attribute name="itemtype" value="http://schema.org/Product" />

app/code/Magento/Catalog/view/frontend/templates/product/view/gallery.phtml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,9 @@ $mainImageData = $mainImage ?
3232
<img
3333
alt="main product photo"
3434
class="gallery-placeholder__image"
35-
itemprop="image"
3635
src="<?= /* @noEscape */ $mainImageData ?>"
3736
/>
38-
<meta itemprop="image" content="<?= /* @noEscape */ $mainImageData ?>">
37+
<link itemprop="image" href="<?= /* @noEscape */ $mainImageData ?>">
3938
</div>
4039

4140
<script type="text/x-magento-init">

app/code/Magento/Catalog/view/frontend/templates/product/view/microdata/currency.phtml

Lines changed: 0 additions & 25 deletions
This file was deleted.

app/code/Magento/Catalog/view/frontend/templates/product/view/microdata/general.phtml

Lines changed: 0 additions & 39 deletions
This file was deleted.

app/code/Magento/Catalog/view/frontend/web/js/gallery-mixin.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,11 @@ define([
2828
this._super(config, element);
2929
$(element).one('f:load', function (event) {
3030
if ($(event.target).hasClass('fotorama__active')) {
31-
let metaImg = document.createElement('meta');
31+
let linkImg = document.createElement('link');
3232

33-
$(metaImg).attr('itemprop', 'image');
34-
$(metaImg).attr('content', $(event.target).find('img').attr('src'));
35-
$(event.target).append(metaImg);
36-
$(event.target).find('img').attr('itemprop', 'image');
33+
$(linkImg).attr('itemprop', 'image');
34+
$(linkImg).attr('href', $(event.target).find('img').attr('src'));
35+
$(event.target).append(linkImg);
3736
}
3837
});
3938
}

dev/tests/js/jasmine/tests/lib/mage/gallery/gallery.test.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,9 @@ define([
5757
position: '1',
5858
type: 'image',
5959
videoUrl: null,
60-
thumb: 'http://test.domain/thumb-image.jpeg',
61-
full: 'http://test.domain/full-image.jpeg',
62-
img: 'http://test.domain/image.jpeg'
60+
thumb: '',
61+
full: '',
62+
img: ''
6363
}
6464
],
6565
magnifierOpts: {
@@ -78,7 +78,7 @@ define([
7878
};
7979
element = $('<div class="gallery-placeholder' +
8080
' _block-content-loading" data-gallery-role="gallery-placeholder">' +
81-
'<img alt="main product photo" class="gallery-placeholder__image" itemprop="image" src="">' +
81+
'<img alt="main product photo" class="gallery-placeholder__image" src="">' +
8282
'</div>');
8383
});
8484

@@ -101,7 +101,6 @@ define([
101101
expect(gallery.settings.api).toBeDefined();
102102
expect(gallery.settings.activeBreakpoint).toEqual({});
103103
expect(gallery.config.options.height).toEqual(element.height());
104-
expect(gallery.settings.$elementF.find('img[itemprop]')).toBeDefined();
105104

106105
$.fn.data = originSpy;
107106
});

lib/web/mage/gallery/gallery.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -314,10 +314,6 @@ define([
314314
$fotoramaElement.fotorama(config);
315315
$fotoramaElement.find('.fotorama__stage__frame.fotorama__active')
316316
.one('f:load', function () {
317-
// Mark itemprop on main image
318-
$fotoramaElement
319-
.find('.fotorama__stage__frame.fotorama__active img')
320-
.attr('itemprop', 'image');
321317
// Remove placeholder when main gallery image loads.
322318
$element.find('.gallery-placeholder__image').remove();
323319
$element

0 commit comments

Comments
 (0)