[FIX] website_sale: Added base_url to schema.org microdata tags

Steps to reproduce the bug:
- install eCommerce module with assets
- go to any product page
- check the source code with https://validator.schema.org/

Notice that the 'image' and 'url' microdata tags have no base url,
so the engine assumes http://schema.org/ to be the base url. This
makes certain ad trackers such as facebook pixel unable to detect
the product being sold.

This commit adds the base_url field to both tags so that they are
correctly traced.

opw-2830058

closes odoo/odoo#99328

X-original-commit: 6817b964156938afb1f9ef261413e76ba256067f
Signed-off-by: William Braeckman (wbr) <wbr@odoo.com>
This commit is contained in:
Stefan-Calin Crainiciuc (stcc)
2022-09-01 02:57:01 +02:00
committed by William Braeckman
parent fef332bec4
commit 859351aa57
+4 -2
View File
@@ -634,8 +634,10 @@
<t t-call="website_sale.shop_product_images"/>
</div>
<div t-attf-class="col-lg-#{image_cols[1]} mt-md-4" id="product_details">
<t t-set="base_url" t-value="product.get_base_url()"/>
<h1 itemprop="name" t-field="product.name">Product Name</h1>
<span itemprop="url" style="display:none;" t-esc="product.website_url"/>
<span itemprop="url" style="display:none;" t-esc="base_url + product.website_url"/>
<span itemprop="image" style="display:none;" t-esc="base_url + website.image_url(product, 'image_1920')" />
<t t-if="is_view_active('website_sale.product_comment')">
<a href="#o_product_page_reviews" class="o_product_page_reviews_link text-decoration-none">
<t t-call="portal_rating.rating_widget_stars_static">
@@ -2004,7 +2006,7 @@
<div t-if="product_image._name == 'product.image' and product_image.embed_code" t-att-class="image_classes + ' ratio ratio-16x9'">
<t t-out="product_image.embed_code"/>
</div>
<div t-else="" t-field="product_image.image_1920" t-att-class="image_classes + ' oe_unmovable'" t-options='{"widget": "image", "preview_image": "image_1024", "class": "oe_unmovable product_detail_img mh-100", "alt-field": "name", "zoom": product_image.can_image_1024_be_zoomed and "image_1920", "itemprop": "image"}'/>
<div t-else="" t-field="product_image.image_1920" t-att-class="image_classes + ' oe_unmovable'" t-options='{"widget": "image", "preview_image": "image_1024", "class": "oe_unmovable product_detail_img mh-100", "alt-field": "name", "zoom": product_image.can_image_1024_be_zoomed and "image_1920"}'/>
</template>
<!-- Product page images: Carousel -->