<ul class="lang-switch nav navbar-nav navbar-right">
    <li role="heading"><span class="nav-plain-text">Language:</span></li>
    <li><a {% if page.lang contains 'en' %} class="active-lang"{% endif %} href="
        {% if page.url contains '/fr' %}{{ page.url | remove_first:'/fr' }}
        {% elsif page.url contains '/es' %}{{ page.url | remove_first:'/es' }}
        {% else %}{{ page.url }}
        {% endif %}" title="English">En</a></li>

    <li><a {% if page.lang contains 'fr' %} class="active-lang"{% endif %} href="
        {% if page.url contains '/fr' %}{{ page.url }}
        {% elsif page.url contains '/es' %}{{ page.url | replace_first:'/es','/fr' }}
        {% else %}{{ page.url | prepend:'/fr' }}
        {% endif %}" title="French">Fr</a></li>

    <li><a {% if page.lang contains 'es' %} class="active-lang"{% endif %} href="
        {% if page.url contains '/es' %}{{ page.url }}
        {% elsif page.url contains '/fr' %}{{ page.url | replace_first:'/fr','/es' }}
        {% else %}{{ page.url | prepend:'/es' }}
        {% endif %}" title="Spanish">Es</a></li>
</ul>
