{% sw_extends '@Storefront/storefront/page/product-detail/meta.html.twig' %}
{# Make sure that the meta title will be displayed #}
{% block layout_head_title %}
{% if metaTitle is not empty %}
<title>{% block dreisc_seo__layout_head_title__title_inner %}{{ metaTitle }}{% endblock %}</title>
{% else %}
{{ parent() }}
{% endif %}
{% endblock %}
{% block layout_head_meta_tags_opengraph %}
{# Fecth social media data #}
{% set socialMediaDataStruct = page.extensions[constant('DreiscSeoPro\\Subscriber\\Installment\\SocialMedia\\SocialMediaSubscriber::DREISC_SEO_INSTALLMENT_SOCIAL_MEDIA_DATA')] %}
{% if null == socialMediaDataStruct %}
{# Call the parent #}
{{ parent() }}
{% else %}
{% block dreisc_seo__layout_head_meta_tags_opengraph__og_type %}
<meta property="og:type" content="product"/>
{% endblock %}
{% block dreisc_seo__layout_head_meta_tags_opengraph__og_site_name %}
<meta property="og:site_name" content="{{ config('core.basicInformation.shopName') }}"/>
{% endblock %}
{% block dreisc_seo__layout_head_meta_tags_opengraph__url %}
<meta property="og:url" content="{{ seoUrl('frontend.detail.page', { productId: page.product.id }) }}"/>
{% endblock %}
{% block dreisc_seo__layout_head_meta_tags_opengraph__og_title %}
{% if socialMediaDataStruct.facebookTitle is not empty %}
<meta property="og:title" content="{{ socialMediaDataStruct.facebookTitle }}"/>
{% else %}
<meta property="og:title" content="{{ metaTitle }}"/>
{% endif %}
{% endblock %}
{% block dreisc_seo__layout_head_meta_tags_opengraph__og_description %}
{% if socialMediaDataStruct.facebookDescription is not empty %}
<meta property="og:description" content="{{ socialMediaDataStruct.facebookDescription }}"/>
{% else %}
<meta property="og:description" content="{{ metaDescription }}"/>
{% endif %}
{% endblock %}
{% block dreisc_seo__layout_head_meta_tags_opengraph__og_image %}
{% if socialMediaDataStruct.facebookImage is not empty %}
<meta property="og:image" content="{{ socialMediaDataStruct.facebookImage }}"/>
{% else %}
<meta property="og:image" content="{{ page.product.cover.media.url }}"/>
{% endif %}
{% endblock %}
{% block dreisc_seo__layout_head_meta_tags_opengraph__og_product_brand %}
{% if page.product.manufacturer %}
<meta property="product:brand" content="{{ page.product.manufacturer.translated.name }}"/>
{% endif %}
{% endblock %}
{% block dreisc_seo__layout_head_meta_tags_opengraph__og_product_price %}
{% set metaPrice = page.product.calculatedPrice %}
{% if page.product.calculatedPrices.count > 0 %}
{% set metaPrice = page.product.calculatedPrices.last %}
{% endif %}
<meta property="product:price:amount"
content="{{ metaPrice.unitPrice|round(context.currency.itemRounding.decimals) }}"/>
<meta property="product:price:currency"
content="{{ context.currency.isoCode }}"/>
{% endblock %}
{% block dreisc_seo__layout_head_meta_tags_opengraph__og_product_link %}
<meta property="product:product_link" content="{{ seoUrl('frontend.detail.page', { productId: page.product.id }) }}"/>
{% endblock %}
{% block dreisc_seo__layout_head_meta_tags_twitter__card %}
<meta name="twitter:card" content="product"/>
{% endblock %}
{% block dreisc_seo__layout_head_meta_tags_twitter__site %}
<meta name="twitter:site" content="{{ config('core.basicInformation.shopName') }}"/>
{% endblock %}
{% block dreisc_seo__layout_head_meta_tags_twitter__title %}
{% if socialMediaDataStruct.twitterTitle is not empty %}
<meta property="twitter:title" content="{{ socialMediaDataStruct.twitterTitle }}"/>
{% else %}
<meta property="twitter:title" content="{{ metaTitle }}"/>
{% endif %}
{% endblock %}
{% block dreisc_seo__layout_head_meta_tags_twitter__description %}
{% if socialMediaDataStruct.twitterDescription is not empty %}
<meta property="twitter:description" content="{{ socialMediaDataStruct.twitterDescription }}"/>
{% else %}
<meta property="twitter:description" content="{{ metaDescription }}"/>
{% endif %}
{% endblock %}
{% block dreisc_seo__layout_head_meta_tags_twitter__image %}
{% if socialMediaDataStruct.twitterImage is not empty %}
<meta property="twitter:image" content="{{ socialMediaDataStruct.twitterImage }}"/>
{% else %}
<meta property="twitter:image" content="{{ page.product.cover.media.url }}"/>
{% endif %}
{% endblock %}
{% endif %}
{% endblock %}
{% block layout_head_canonical %}{% apply spaceless %}
{% set canonicalDataStruct = page.extensions[constant('DreiscSeoPro\\Subscriber\\Installment\\Canonical\\CanonicalSubscriber::DREISC_SEO_INSTALLMENT_CANONICAL_DATA')] %}
{% if null != canonicalDataStruct and canonicalDataStruct.canonicalLink is not empty %}
{% block dreisc_seo__layout_head_canonical__individual %}
<link rel="canonical" href="{{ canonicalDataStruct.canonicalLink }}" />
{% endblock %}
{% else %}
{# Call parent #}
{{ parent() }}
{% endif %}
{% endapply %}{% endblock %}