{% extends "_base.html" %}

{% block page %}blog{% endblock page%}
{% block lang %}{% if section.extra.lang %}{{ section.extra.lang }}{% else %}{{ section.lang }}{% endif %}{% endblock lang %}
{% block title %}{{ section.title }}{% endblock title %}
{% block desc %}
  <meta name="description" content="{{ section.description }}">
{% endblock desc %}

{% block content %}
{% include "_header.html" %}
<div id="wrapper">
  <main class="layout-list">
    {% if config.extra.blog_categorized %}
    {% for category,posts in section.pages | group_by(attribute="taxonomies.categories.0") -%}
    <div class="category">{{ category }}</div>
    <div>
      {% for post in posts %}
      <a class="post" href="{{ post.permalink }}">
        <span>{{ post.title }}</span>
        <span class="date">{{ post.date | date}}</span>
      </a>
      {% endfor %}
    </div>
    {% endfor %}
    {% else %}
    <div class="post-list">
      {% for post in section.pages %}
      <a class="post" href="{{ post.permalink }}">
        <span>{{ post.title }}</span>
        <span class="line"></span>
        <span class="date">{{ post.date | date}}</span>
      </a>
      {% endfor %}
    </div>
    {% endif %}
  </main>
  {% include "_footer.html" %}
</div>
{% endblock content %}