templates/default/components/molecules/breadcrumb/breadcrumb-schema.html.twig line 1

Open in your IDE?
  1. {% if breadcrumbs|default([]) %}
  2. {% set currentPath = app.request.host %}
  3. {% set itemListElement = {} %}
  4. {% for key, step in breadcrumbs %}
  5. {% if step.link is defined %}
  6. {% set itemListElement = itemListElement | merge ({
  7. (key): {
  8. "@type": "ListItem",
  9. "position": key + 1,
  10. "name": step.name,
  11. "item": app.request.scheme ~ '://' ~currentPath ~ step.link
  12. }
  13. }) %}
  14. {% endif %}
  15. {% if loop.last and ((page is defined and page is same as ('detail')) or page_type is same as ('product')) %}
  16. {% set itemListElement = itemListElement | merge ({
  17. (key): {
  18. "@type": "ListItem",
  19. "position": key + 1,
  20. "name": product.name|default(variant.name|default('')),
  21. "item": app.request.scheme ~ '://' ~currentPath ~ product.slug|default('')
  22. }
  23. }) %}
  24. {% endif %}
  25. {% endfor %}
  26. {% set schemaOrg = {
  27. "@context": "https://schema.org",
  28. "@type": "BreadcrumbList",
  29. "itemListElement": itemListElement,
  30. } %}
  31. {% include('components/atoms/schema-org/schema-org.html.twig') with {
  32. 'schemaOrg': schemaOrg
  33. } %}
  34. {% endif %}