Initial work on adding i18n support, drop footer link support (breaking change!)
This commit is contained in:
12
templates/partials/language_switcher.html
Normal file
12
templates/partials/language_switcher.html
Normal file
@ -0,0 +1,12 @@
|
||||
{% if config.extra.language_switcher %}
|
||||
<div class="lang" aria-label="{{ trans(key="language", lang=lang) }}">
|
||||
{% set language_agnostic_path = current_path | default(value="/") | replace(from='/' ~ lang ~ '/', to = '/') | trim_start_matches(pat = '/') %}
|
||||
{% for tr in config.extra.translations %}
|
||||
{% if tr.code == lang %}
|
||||
<span class="active">{{ tr.name }}</span>
|
||||
{% else %}
|
||||
<a href="{{ get_url(path=language_agnostic_path, lang=tr.code) ~ "/" }}" hreflang="{{ tr.code }}" lang="{{ tr.code }}">{{ tr.name }}</a>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endif %}
|
Reference in New Issue
Block a user