//- pug/js cannot get on well with liquid/ruby, especially in passing parameters

mixin postInfo(item)
    .post-info
        != full_date(item.date, 'll')
        if item.from && (is_home() || is_post())
            a.post-from(href=item.from target="_blank" title=item.from)!= __('translated')

//- todo, currently using copy and paste

//- Index Page mixin posts()

| {% assign date_format = site.date_format | default: "%b %-d, %Y" %}
ul.home.post-list
    | {% for post in site.posts %}
    li.post-list-item
        article.post-block
            h2.post-title
                a.post-title-link(href="{{ post.url | relative_url }}")!= "{{ post.title }}"
            .post-info
                != "{{ post.date | date: date_format }}"
                | {% if post.from %}
                a.post-from(href="{{ post.from }}" target="_blank" title="{{ post.from }}")
                    != "{{ site.data.lang[site.lang].translated | default: 'Translation · Original Link' }}"
                | {% endif %}
            .post-content
                != "{{ post.excerpt }}"
            a.read-more(href="{{ post.url | relative_url }}")
                != "{{ site.data.lang[site.lang].more | default: '...more' }}"
    | {% endfor %}

//- Archive Page mixin postList()

| {% assign date_format = site.date_format | default: "%b %-d, %Y" %}
.archive
    | {% assign prev_year = 0 %}
    | {% for post in site.posts %}
    |   {% assign year = post.date | date: "%Y" %}
    |   {% if year != prev_year %}
    h2.archive-year!= "{{ year }}"
    |   {% assign prev_year = year %}
    |   {% endif %}
    .post-item
        .post-info
            != "{{ post.date | date: date_format }}"
        a.post-title-link(href="{{ post.url | relative_url }}")!= "{{ post.title }}"
    | {% endfor %}

//- Post Page mixin post()

| {% assign date_format = site.date_format | default: "%b %-d, %Y" %}
.post
    article.post-block
        h1.post-title
            != "{{ page.title }}"
        .post-info
            != "{{ page.date | date: date_format }}"
            | {% if page.from %}
            |   {% if page.layout == "home" or page.layout == "post" %}
            a.post-from(href="{{ page.from }}" target="_blank" title="{{ page.from }}")
                != "{{ site.data.lang[site.lang].translated | default: 'Translation · Original Link' }}"
            |   {% endif %}
            | {% endif %}
        .post-content
            != "{{ content }}"

//- Page Page mixin page()

.post
    article.post-block
        h1.post-title
            != "{{ page.title }}"
        .post-info
            != "    "
            | {% if page.from %}
            |   {% if page.layout == "home" or page.layout == "post" %}
            a.post-from(href="{{ page.from }}" target="_blank" title="{{ page.from }}")
                != "{{ site.data.lang[site.lang].translated | default: 'Translation · Original Link' }}"
            |   {% endif %}
            | {% endif %}
        .post-content
            != "{{ content }}"