rf-web/_includes/common/lang-selector.html

38 lines
1.4 KiB
HTML

{% assign posts=site.posts | where:"ref", page.ref | sort: 'lang' %}
{% assign pages=site.pages | where:"ref", page.ref | sort: 'lang' %}
<div class="nav-group lang-selector">
{% if posts.size > 1 %}
{% for post in posts %}
{% if post.lang != page.lang %}
<a href="{{ site.base-url }}{{ post.url }}" class="lang lang--{{ page.lang }}">
{% if page.lang == 'en' %}
{{ include.fr-text }}
{% else %}
{{ include.en-text }}
{% endif %}
</a>
{% endif %}
{% endfor %}
{% elsif pages.size > 1 %}
{% for newpage in pages %}
{% if newpage.lang != page.lang and page.ref != '' %}
{% if page.lang == 'en' %}
<a href="{{ newpage.url }}" class="lang lang--{{ page.lang }}">{{ include.fr-text }}</a>
{% else %}
<a href="{{ newpage.url }}" class="lang lang--{{ page.lang }}">{{ include.en-text }} </a>
{% endif %}
{% endif %}
{% endfor %}
{% elsif page.lang == 'en' %}
<a href="/fr" class="lang lang--{{ page.lang }}">{{ include.fr-text }}</a>
{% else %}
<a href="/" class="lang lang--{{ page.lang }}">{{ include.en-text }} </a>
{% endif %}
</div>