custom/plugins/SelfdelveCms/src/Resources/views/storefront/page/product-detail/meta.html.twig line 1

Open in your IDE?
  1. {% sw_extends '@Storefront/storefront/page/product-detail/meta.html.twig' %}
  2. {% block layout_head_canonical %}
  3.     {# Default case: the product itself #}
  4.     {% set canonicalUrl = page.product.id %}
  5.     {% if page.product.customFields.selfdelve_theme_product_canonical_product %}
  6.         {# Any product specified in custom fields #}
  7.         {% set canonicalUrl = page.product.customFields.selfdelve_theme_product_canonical_product %}
  8.     {% elseif page.product.parentId %}
  9.         {# Parent product for each variant #}
  10.         {% set canonicalUrl = page.product.parentId %}
  11.     {% endif %}
  12.     <link rel="canonical" href="{{ seoUrl('frontend.detail.page', { productId: canonicalUrl }) }}" />
  13. {% endblock %}