wiki-grav/plugins/language-selector/templates/partials/language-selector.hreflang.html.twig
2022-11-19 15:41:36 +01:00

9 lines
403 B
Twig

{% set langobj = grav['language'] %}
{% for key in language_selector.languages %}
{% if key == language_selector.current %}
{% set lang_url = page.url %}
{% else %}
{% set lang_url = base_url_simple ~ langobj.getLanguageURLPrefix(key) ~ language_selector.page_route ~ page.urlExtension ?: '/' %}
{% endif %}
<link rel="alternate" hreflang="{{ key }}" href="{{ lang_url ~ uri.params }}" />
{% endfor %}