{% sw_extends '@Storefront/storefront/page/product-detail/meta.html.twig' %}
{% block layout_head_javascript_feature %}
{% block hueb_seo_rich %}
{% if page.HuebertSeoUltimate.config.conversion.rich.active %}
{% set richSnippets = page.extensions["richSnippets"] %}
{% set jsonData %}
{
"@context": "https://schema.org/",
"@type": "Product",
"name": "{{ page.product.translated.name }}",
{% if page.product.weight %}"weight": "{{ page.product.weight }} kg",{% endif %}
{% if page.product.height %}"height": "{{ page.product.height }} mm",{% endif %}
{% if page.product.width %}"width": "{{ page.product.width }} mm",{% endif %}
{% if page.product.length %}"length": "{{ page.product.length }} mm",{% endif %}
"releaseDate": "{{ page.product.releaseDate|format_date(pattern="Y-MM-dd", locale=app.request.locale) }}",
"productID": "{{ page.product.id }}",
"image": [
{% for image in page.product.media.media %}
"{{ image.url }}"{% if not loop.last %},{% endif %}
{% endfor %}
],
"description": "{{ page.product.translated.description|escape }}",
"sku":{% if richSnippets.sku %} "{{ richSnippets.sku }}",{% else %}"{{ page.product.productNumber }}",{% endif %}
"mpn":{% if richSnippets.mpn %} "{{ richSnippets.mpn }}",{% else %}"{{ page.product.productNumber }}",{% endif %}
"gtin13": "{{ page.product.ean }}",
"brand": {
"@type": "Brand",
"name": "{{ page.product.manufacturer.translated.name }}"
},
{% if page.reviews|length %}
"aggregateRating": {
"@type": "AggregateRating",
"ratingCount": "{{ page.reviews|length }}",
"ratingValue": "{{ page.reviews.matrix.averageRating|round(2, 'floor') }}",
"bestRating": "5"
},
{% endif %}
"offers": {
"@type": "Offer",
"url": "{{ seoUrl('frontend.detail.page', { productId: page.product.id }) }}",
"priceCurrency": "{{ context.currency.translated.shortName }}",
"price": "{{ page.product.calculatedPrice.unitPrice }}",
{% if richSnippets.priceValidUntil %}"priceValidUntil": "{{ richSnippets.priceValidUntil }}", {% endif %}
"itemCondition":{% if richSnippets.itemCondition %}"{{ richSnippets.itemCondition }}",{% else %}"https://schema.org/NewCondition",{% endif %}
"availability":{% if page.product.availableStock >= page.product.minPurchase and page.product.deliveryTime %}"https://schema.org/InStock"{% elseif page.product.availableStock < page.product.minPurchase and page.product.deliveryTime and page.product.restockTime %}"https://schema.org/BackOrder"{% else %}"https://schema.org/OutOfStock"{% endif %}
}
}
{% endset %}
<script type="application/ld+json">
{{ jsonData }}
</script>
{% endif %}
{% endblock %}
{{ parent() }}
{% endblock %}
{% block layout_head_title_inner %}{% if metaTitle %}{{ metaTitle }}{% else %}{{ page.product.translated.name }}{% if page.product.variation %} - {% for variation in page.product.variation %}{{ variation.group }}: {{ variation.option }}{% if page.product.variation|last != variation %}{{ " | " }}{% endif %}{% endfor %}{% endif %}{% endif %}{% endblock %}
{% block layout_head_canonical %}
{% set canonicalUrl = page.product.id %}
{% if page.product.canonicalProductId %}
{% set canonicalUrl = page.product.canonicalProductId %}
{% endif %}
{% if page.extensions["richSnippets"].additional1 %}
<link rel="canonical" href="{{ page.extensions["richSnippets"].additional1|raw }}" />
{% else %}
<link rel="canonical" href="{{ seoUrl('frontend.detail.page', { productId: canonicalUrl }) }}" />
{% endif %}
{% endblock %}