{% embed 'partials/base.html.twig' %}

  {% set collection = page.collection() %}
  {% set base_url = page.url %}
  {% set feed_url = base_url %}
  {% if page.header.show_breadcrumbs is defined %}
    {% set show_breadcrumbs = page.header.show_breadcrumbs %}
  {% else %}
      {% set show_breadcrumbs = true %}
  {% endif %}
  {% if page.header.show_pagination is defined %}
      {% set show_pagination = page.header.show_pagination %}
  {% else %}
      {% set show_pagination = true %}
  {% endif %}

{% if uri.param('category') %}
	{% set page_title = theme_config.listing_title.taxonomy.category | default('Posts in Category: ') ~ uri.param('category') %}
{% elseif uri.param('tag') %}
	{% set page_title = theme_config.listing_title.taxonomy.tag | default('Posts with Tag: ') ~ uri.param('tag') %}
{% elseif uri.param('author') %}
	{% set page_title = theme_config.listing_title.taxonomy.author | default('Posts from Author: ') ~ uri.param('author') %}
{% else %}
	{% set page_title = theme_config.listing_title.blog | default('') %}
{% endif %}

  {% if base_url == '/' %}
    {% set base_url = '' %}
  {% endif %}

  {% if base_url == base_url_relative %}
    {% set feed_url = base_url~'/'~page.slug %}
  {% endif  %}

  {% block menu %}
    {% include 'partials/sidebar_right.html.twig' %}
  {% endblock %}
  
  {% block content %}
    {% if show_breadcrumbs and config.plugins.breadcrumbs.enabled %}
        {% include 'partials/breadcrumbs.html.twig' %}
    {% endif %}
    
    <h2>
      {{page_title}}
    </h2>
    
    {% for child in collection %}
      {% include 'partials/blog_item.html.twig' with {'page':child, 'truncate':true} %}
    {% endfor %}

    {% if show_pagination and config.plugins.pagination.enabled and collection.params.pagination %}
      {% include 'partials/pagination.html.twig' with {base_url: page.url, pagination: collection.params.pagination} %}
    {% endif %}
  {% endblock %}

  {% block sidebar %}
    {% if theme_config.sidebar == true %}
      {% include 'partials/sidebar_left.html.twig' %}
    {% endif %}
  {% endblock %}
  
{% endembed %}