/
lang_nav.html
36 lines (30 loc) · 1.18 KB
/
lang_nav.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
{%comment%} check for the presence of the path in an array of paths. {%endcomment%}
<nav>
{% for block in site.data.map %}
{% for item in block[page.lang] %}
{% if item == page.path %}
{% for trans in block %}
{% assign trans_path = trans[1] %}
{% assign posts = site.posts | where:"path",trans_path %}
{% for item in posts %}
{% if item.path == page.path %}
<a hreflang="{{item.lang}}" class="active">{{site.data.locales[item.lang].lang.title}}</a>
{% else %}
<a hreflang="{{item.lang}}" href="{{item.url|absolute_url}}">{{site.data.locales[item.lang].lang.title}}</a>
{% endif %}
{{site.data.locales[item.lang].lang.icon}}
{% endfor %}
{% assign pages = site.pages | where:"path",trans_path %}
{% for item in pages %}
{% if item.path == page.path %}
<a hreflang="{{item.lang}}" class="active">{{site.data.locales[item.lang].lang.title}}</a>
{% else %}
<a hreflang="{{item.lang}}" href="{{item.url|absolute_url}}">{{site.data.locales[item.lang].lang.title}}</a>
{% endif %}
{{site.data.locales[item.lang].lang.icon}}
{% endfor %}
{% endfor %}
{% endif %}
{% endfor %}
{% endfor %}
</nav>