custom/plugins/HuebertSeoUltimate/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_javascript_feature %}
  3.     {% block hueb_seo_rich %}
  4.         {%  if page.HuebertSeoUltimate.config.conversion.rich.active %}
  5.             {% set richSnippets = page.extensions["richSnippets"] %}
  6.             {% set jsonData %}
  7.                 {
  8.                     "@context": "https://schema.org/",
  9.                     "@type": "Product",
  10.                     "name": "{{ page.product.translated.name }}",
  11.                     {% if page.product.weight %}"weight": "{{ page.product.weight }} kg",{% endif %}
  12.                     {% if page.product.height %}"height": "{{ page.product.height }} mm",{% endif %}
  13.                     {% if page.product.width %}"width": "{{ page.product.width }} mm",{% endif %}
  14.                     {% if page.product.length %}"length": "{{ page.product.length }} mm",{% endif %}
  15.                     "releaseDate": "{{ page.product.releaseDate|format_date(pattern="Y-MM-dd", locale=app.request.locale) }}",
  16.                     "productID": "{{ page.product.id }}",
  17.                     "image": [
  18.                     {% for image in page.product.media.media %}
  19.                         "{{ image.url }}"{% if not loop.last %},{% endif %}
  20.                     {% endfor %}
  21.                     ],
  22.                     "description": "{{ page.product.translated.description|escape }}",
  23.                     "sku":{% if richSnippets.sku %} "{{ richSnippets.sku }}",{% else %}"{{ page.product.productNumber }}",{% endif %}
  24.                     "mpn":{% if richSnippets.mpn %} "{{ richSnippets.mpn }}",{% else %}"{{ page.product.productNumber }}",{% endif %}
  25.                     "gtin13": "{{ page.product.ean }}",
  26.                     "brand": {
  27.                         "@type": "Brand",
  28.                         "name": "{{ page.product.manufacturer.translated.name }}"
  29.                     },
  30.                     {% if page.reviews|length %}
  31.                     "aggregateRating": {
  32.                         "@type": "AggregateRating",
  33.                         "ratingCount": "{{ page.reviews|length }}",
  34.                         "ratingValue": "{{ page.reviews.matrix.averageRating|round(2, 'floor') }}",
  35.                         "bestRating": "5"
  36.                     },
  37.                     {% endif %}
  38.                     "offers": {
  39.                         "@type": "Offer",
  40.                         "url": "{{ seoUrl('frontend.detail.page', { productId: page.product.id }) }}",
  41.                         "priceCurrency": "{{ context.currency.translated.shortName }}",
  42.                         "price": "{{ page.product.calculatedPrice.unitPrice }}",
  43.                         {% if richSnippets.priceValidUntil %}"priceValidUntil": "{{ richSnippets.priceValidUntil }}", {% endif %}
  44.                         "itemCondition":{% if richSnippets.itemCondition %}"{{ richSnippets.itemCondition }}",{% else %}"https://schema.org/NewCondition",{% endif %}
  45.                         "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 %}
  46.                     }
  47.                 }
  48.             {% endset %}
  49.             <script type="application/ld+json">
  50.                 {{ jsonData }}
  51.             </script>
  52.         {% endif %}
  53.     {% endblock %}
  54.     {{ parent() }}
  55. {% endblock %}
  56. {% 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 %}
  57. {% block layout_head_canonical %}
  58.     {% set canonicalUrl = page.product.id %}
  59.     {% if page.product.canonicalProductId %}
  60.         {% set canonicalUrl = page.product.canonicalProductId %}
  61.     {% endif %}
  62.     {% if page.extensions["richSnippets"].additional1 %}
  63.         <link rel="canonical" href="{{ page.extensions["richSnippets"].additional1|raw }}" />
  64.     {% else %}
  65.         <link rel="canonical" href="{{ seoUrl('frontend.detail.page', { productId: canonicalUrl }) }}" />
  66.     {% endif %}
  67. {% endblock %}