-
-
Save umkasanki/bd77a9d8ff19c0e2ba5e389ceab2c31b to your computer and use it in GitHub Desktop.
Simple multilanguage nav
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% set navlist = nav.navlist %} | |
{% for item in navlist %} | |
<a href="{{ item.url }}">{{ item.title | t }}</a> | |
{% if loop.last %} | |
{% for locale in craft.i18n.getSiteLocales() %} | |
{% set localeData = craft.i18n.getLocaleData(locale.id) %} | |
{% if entry is not null %} | |
{% if craft.locale != locale %} | |
{% set localisedEntry = craft.entries.id(entry.id).locale(locale.id).first() %} | |
<a href="{{ localisedEntry.url }}">{{ locale | upper }}</a> | |
{% endif %} | |
{% endif %} | |
{% endfor %} | |
{% endif %} | |
{% endfor %} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment