{%- include languages/languages.html -%}
{%- if page.permalink == nil -%}
{%- for i in matchurls -%}
{%- for checklang in site.pages -%}
{%- if checklang.permalink == i -%}
{%- assign languagetext = [i] -%}
{% if site.noindex_languages contains languagetext[0] %}
{%- else -%}
{%- endif -%}
{%- endif -%}
{%- endfor -%}
{%- endfor -%}
{%- else -%}
{%- if matchurls contains page.permalink -%}
{%- assign languagetext = [i] -%}
{%- for i in matchurls -%}
{%- assign languagetext = [i] -%}
{%- if i== page.permalink -%}
{% if site.noindex_languages contains languagetext[0] %}
{%- else -%}
{%- endif -%}
{%- else -%}
{%- for checklang in site.pages -%}
{%- if checklang.permalink == i -%}
{%- assign languagetext = [i] -%}
{% if site.noindex_languages contains languagetext[0] %}
{%- else -%}
{%- endif -%}
{%- endif -%}
{%- endfor -%}
{%- endif -%}
{%- endfor -%}
{%- else -%}
{%- for item in site.pages -%}
{%- assign languagetext = [item.lang] -%}
{%- assign pagelink = page.permalink | split: "/" | last-%}
{%- assign itemlink = item.permalink | split: "/" | last-%}
{%- if pagelink == itemlink and page.lang != item.lang and page.permalink !=
item.permalink -%}
{% if site.noindex_languages contains languagetext[0] %}
{%- else -%}
{%- endif -%}
{%- endif -%}
{%- if pagelink == itemlink and page.lang == item.lang -%}
{% if site.noindex_languages contains languagetext[0] %}
{%- else -%}
{%- endif -%}
{%- endif -%}
{%- endfor -%}
{%- endif -%}
{%- endif -%}