File tree 1 file changed +13
-2
lines changed
1 file changed +13
-2
lines changed Original file line number Diff line number Diff line change 42
42
< nav itemscope itemtype ="http://schema.org/SiteNavigationElement ">
43
43
{% if config.languages %}
44
44
< div style ="float: right ">
45
+ <!-- does not show the current language -->
45
46
{% for key, value in config.languages %}
47
+ {% set_global lang_url = value.translations.url | safe | replace(from="$BASE_URL", to=config.base_url) | replace(from="$LANG_BASE_URL", to=lang_base_url) %}
48
+ <!-- check to see if the language has a translation of the current article -->
49
+ {% if page %}
50
+ {%for ea_translation in page.translations%}
51
+ {%if ea_translation.lang == key%}
52
+ {% set_global lang_url = ea_translation.permalink %}
53
+ {%endif%}
54
+ {% endfor %}
55
+ {% elif taxonomy.slug %}
56
+ {% set_global lang_url = value.translations.url ~ `/` ~ taxonomy.slug | safe | replace(from="$BASE_URL", to=config.base_url) | replace(from="$LANG_BASE_URL", to=lang_base_url) %}
57
+ {% endif %}
46
58
< a itemprop ="url "
47
- class ="navbar {% if value.translations.url | replace(from= "$BASE_URL ", to=config.base_url) | replace(from ="$LANG_BASE_URL ", to =lang_base_url) == current_url %}active{% endif %}"
48
- href="{{ value.translations.url | safe | replace(from="$BASE_URL", to=config.base_url) | replace(from="$LANG_BASE_URL", to=lang_base_url) }}">
59
+ href ="{{lang_url}} ">
49
60
< span itemprop ="name "> {% if value.translations.trans_key %}{{ trans(key=value.translations.trans_key, lang=lang) }}{% else %}{{ value.translations.name }}{% endif %}</ span > </ a >
50
61
{% endfor %}
51
62
</ div >
You can’t perform that action at this time.
0 commit comments