{%- include languages/languages.html -%} {%- if page.permalink == nil -%} {%- for i in matchurls -%} {%- for checklang in site.pages -%} {%- if checklang.permalink == i -%} {%- assign languagetext = [i] -%} {% assign whitelist_urls = site.whitelist_urls %} {% if site.noindex_languages contains languagetext[0] %} {%- if whitelist_urls -%} {% for url in whitelist_urls %} {% assign current_url = url | remove_first: '/' | strip %} {% assign language_url = languagetext[0] | strip %} {% if current_url == language_url %} {%- assign exclude_url = true -%} {% endif %} {% endfor %} {%- if exclude_url -%} {%- endif -%} {%- endif -%} {%- 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 -%} {% assign whitelist_urls = site.whitelist_urls %} {% if site.noindex_languages contains languagetext[0] %} {%- if whitelist_urls -%} {% for url in whitelist_urls %} {% assign current_url = url | remove_first: '/' | strip %} {% assign language_url = languagetext[0] | strip %} {% if current_url == language_url %} {%- assign exclude_url = true -%} {% endif %} {% endfor %} {%- if exclude_url -%} {%- endif -%} {%- endif -%} {%- else -%} {%- endif -%} {%- else -%} {%- for checklang in site.pages -%} {%- if checklang.permalink == i -%} {%- assign languagetext = [i] -%} {% if site.noindex_languages contains languagetext[0] %} {%- if whitelist_urls -%} {% for url in whitelist_urls %} {% assign current_url = url | remove_first: '/' | strip %} {% assign language_url = languagetext[0] | strip %} {% if current_url == language_url %} {% endif %} {% endfor %} {%- endif -%} {%- 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] %} {%- if whitelist_urls -%} {% for url in whitelist_urls %} {% assign current_url = url | strip %} {% if current_url == item.permalink %} {% endif %} {% endfor %} {%- endif -%} {%- else -%} {%- endif -%} {%- endif -%} {%- if pagelink == itemlink and page.lang == item.lang -%} {% assign whitelist_urls = site.whitelist_urls %} {% if site.noindex_languages contains languagetext[0] %} {%- if whitelist_urls -%} {% for url in whitelist_urls %} {% assign current_url = url | strip %} {% if current_url == item.permalink %} {%- assign exclude_url = true -%} {% endif %} {% endfor %} {%- if exclude_url -%} {%- endif -%} {%- endif -%} {%- else -%} {% assign final_permalink = item.permalink %} {% if item.permalink contains '/' %} {% else %} {% assign final_permalink = '/' | append: item.permalink %} {% endif %} {%- if site.blacklist_urls contains final_permalink -%} {%- else -%} {%- endif -%} {%- endif -%} {%- endif -%} {%- endfor -%} {%- endif -%} {%- endif -%}