- {% set language_obj = grav.language %}
- {% for language in langswitcher.languages %}
- {% if langswitcher.translated_routes[language] %}
- {% set lang_url = langswitcher.translated_routes[language] ~ page.urlExtension %}
- {% else %}
- {% set base_lang_url = base_url_simple ~ grav.language.getLanguageURLPrefix(language) %}
- {% set lang_url = base_lang_url ~ langswitcher.page_route ~ page.urlExtension %}
- {% endif %}
- {% set href_url = uri.base ~ lang_url ~ uri.params ~ (uri.query|length > 1 ? '?' ~ uri.query) %}
- {% if (language_obj.default == language and config.languages.include_default_lang == false) %}
- <link rel="alternate" hreflang="x-default" href="{{ href_url }}" />
- {% endif %}
- <link rel="alternate" hreflang="{{ language }}" href="{{ href_url }}" />
- {% endfor %}
|