{% extends "cjkcms/pages/web_page.html" %}

{% load wagtailcore_tags wagtailimages_tags cjkcms_tags %}

{% block index_filters %}{% endblock %}

{% block index_content %}
{% if page.index_show_subpages %}
    <div class="container">
        {% if page.index_classifiers.exists %}
        <div class="row">
            <div class="col-md-9">
        {% endif %}

        {% for article in index_paginated %}
        <div class="row">
            {% if self.show_images %}
            <div class="col-md">
                <a href="{% pageurl article %}" title="{{article.title}}">
                {% if article.cover_image %}
                    {% image article.specific.cover_image fill-1000x500 as cover_image %}
                    <img src="{{cover_image.url}}" class="w-100" alt="{{article.title}}" />
                {% else %}
                    <p class="p-5 lead text-center bg-secondary text-white-50">{{article.title}}</p>
                {% endif %}
                </a>
            </div>
            {% endif %}
            <div class="col-md">
                <h3><a href="{% pageurl article %}">{{article.title}}</a></h3>
                {% if self.show_captions and article.specific.caption %}<p class="lead">{{article.specific.caption}}</p>{% endif %}
                {% if self.show_meta %}<p>{{article.specific.seo_published_at}} &bull; {{article.specific.seo_author}}</p>{% endif %}
                {% if self.show_preview_text %}<p>{{article.specific.body_preview}}</p>{% endif %}
            </div>
        </div>
        {% if not forloop.last %}
        <hr>
        {% endif %}
        {% endfor %}

        {% if page.index_classifiers.exists %}
            </div>
            <div class="col-md-3">
                {% include "cjkcms/includes/classifier_nav.html" with navclass="nav-pills flex-column" %}
            </div>
        </div>
        {% endif %}

    {% include "cjkcms/includes/pagination.html" with items=index_paginated %}

</div>
{% endif %}
{% endblock %}
