templates/vitrine/articles/components/canonical.html.twig line 1

Open in your IDE?
  1. {% if article is not empty %}
  2. {% set esPath = getPathArticleHasLanguages(article.id,"es") %}
  3. {% set enPath = getPathArticleHasLanguages(article.id,"en") %}
  4. {% set frPath = getPathArticleHasLanguages(article.id,"fr") %}
  5. {% set dePath = getPathArticleHasLanguages(article.id,"de") %}
  6. {% set nlPath = getPathArticleHasLanguages(article.id,"nl") %}
  7. {% set defaultPath = enPath %}
  8. {% if app.request.locale == "fr" %}
  9. {% set defaultPath = frPath %}
  10. {% elseif app.request.locale == "de" %}
  11. {% set defaultPath = dePath %}
  12. {% elseif app.request.locale == "nl" %}
  13. {% set defaultPath = nlPath %}
  14. {% elseif app.request.locale == "es" %}
  15. {% set defaultPath = esPath %}
  16. {% endif %}
  17. {% set domainDefault = domain ~ defaultPath %}
  18. {% set domainFrDefault = domain ~ frPath %}
  19. {% set domainEsDefault = domain ~ esPath %}
  20. {% set domainEnDefault = domain ~ enPath %}
  21. {% set domainDeDefault = domain ~ dePath %}
  22. {% set domainNlDefault = domain ~ nlPath %}
  23. {% if app.request.locale == "en" %}
  24. <link rel="canonical" href="{{ domainEnDefault }}" />
  25. {% endif %}
  26. {% if app.request.locale == "fr" %}
  27. <link rel="canonical" href="{{ domainFrDefault }}" />
  28. {% endif %}
  29. {% if app.request.locale == "es" %}
  30. <link rel="canonical" href="{{ domainEsDefault }}" />
  31. {% endif %}
  32. {% if app.request.locale == "nl" %}
  33. <link rel="canonical" href="{{ domainNlDefault }}" />
  34. {% endif %}
  35. {% if app.request.locale == "de" %}
  36. <link rel="canonical" href="{{ domainDeDefault }}" />
  37. {% endif %}
  38. {% if app.request.locale == "en" %}{% set domainEnDefault = app.request.schemeAndHttpHost ~ app.request.basePath ~ app.request.pathInfo %}{% endif %}
  39. {% if enPath != "#" %}
  40. <link rel="alternate" hreflang="x-default" href="{{ domainEnDefault }}" />
  41. <link rel="alternate" hreflang="en" href="{{ domainEnDefault }}" />
  42. {% endif %}
  43. {% if app.request.locale == "fr" %}{% set domainFrDefault = app.request.schemeAndHttpHost ~ app.request.basePath ~ app.request.pathInfo %}{% endif %}
  44. {% if frPath != "#" %}
  45. <link rel="alternate" hreflang="fr" href="{{ domainFrDefault }}" />
  46. {% endif %}
  47. {% if app.request.locale == "de" %}{% set domainDeDefault = app.request.schemeAndHttpHost ~ app.request.basePath ~ app.request.pathInfo %}{% endif %}
  48. {% if dePath != "#" %}
  49. <link rel="alternate" hreflang="de" href="{{ domainDeDefault }}" />
  50. {% endif %}
  51. {% if app.request.locale == "es" %}{% set domainEsDefault = app.request.schemeAndHttpHost ~ app.request.basePath ~ app.request.pathInfo %}{% endif %}
  52. {% if esPath != "#" %}
  53. <link rel="alternate" hreflang="es" href="{{ domainEsDefault }}" />
  54. {% endif %}
  55. {% if app.request.locale == "nl" %}{% set domainNlDefault = app.request.schemeAndHttpHost ~ app.request.basePath ~ app.request.pathInfo %}{% endif %}
  56. {% if nlPath != "#" %}
  57. <link rel="alternate" hreflang="nl" href="{{ domainNlDefault }}" />
  58. {% endif %}
  59. {% endif %}