}

  {% if page.layout == "post" %}
    {% assign i18n_posts = site.posts | where_exp:"p","p.path contains pagename" %}
  {% else %}
    {% assign i18n_posts = site.pages | where_exp:"p","p.path contains pagename" %}
  {% endif %}

  {% for t_lang in site.langs %}
    {% unless t_lang == plang %}
      {% assign t = i18n_posts | where:"lang",t_lang | first %}

      {% if t %}
      <link rel="alternate" hreflang="{{ t_lang }}" href="{{ site.url }}{{ t.url }}" />
      {% endif %}
    {% endunless %}
  {% e