src/DcSiteBundle/Resources/views/Modules/canonical.html.twig line 1

Open in your IDE?
  1. {% if app.request.attributes.get('_route_params')['_locale'] is defined %}
  2.     {% if app.request.host != 'vidi.ua' %}
  3.         <link rel="canonical"
  4.               href="{{ url(app.request.attributes.get('_route'), app.request.attributes.get('_route_params')) }}"/>
  5.     {% else %}
  6.         <link rel="canonical" href="{{ app.request.uri }}"/>
  7.     {% endif %}
  8.     {% if app.request.get('variation') %}
  9.         {% for locale in allowed_locales %}
  10.             <link rel="alternate" hreflang="{% if locale == 'ua' %}uk-ua{% else %}ru-ua{% endif %}"
  11.                   href="{{ absolute_url(path(app.request.attributes.get('_route'),app.request.attributes.get('_route_params')|merge({'_locale': locale, 'variation': app.request.get('variation')}))) }}"/>
  12.         {% endfor %}
  13.         <link rel="alternate" hreflang="x-default"
  14.               href="{{ absolute_url(path(app.request.attributes.get('_route'),app.request.attributes.get('_route_params')|merge({'_locale': 'ua', 'variation': app.request.get('variation')}))) }}"/>
  15.     {% else %}
  16.         {% for locale in allowed_locales %}
  17.             <link rel="alternate" hreflang="{% if locale == 'ua' %}uk-ua{% else %}ru-ua{% endif %}"
  18.                   href="{{ absolute_url(path(app.request.attributes.get('_route'),app.request.attributes.get('_route_params')|merge({'_locale': locale}))) }}"/>
  19.         {% endfor %}
  20.         <link rel="alternate" hreflang="x-default"
  21.               href="{{ absolute_url(path(app.request.attributes.get('_route'),app.request.attributes.get('_route_params')|merge({'_locale': 'ua'}))) }}"/>
  22.     {% endif %}
  23. {% endif %}