{% extends "base.html" %}

{% block title %}Posts{% endblock %}

{% block opengraph %}
    <meta property="og:title" content="Posts" />
    <meta property="og:type" content="website" />
    <meta property="og:description" content="Listing of all posts" />
{% endblock %}

{% block description %}Listing of all posts{% endblock %}

{% block content %}
    <h1>Posts</h1>

    {% if posts.len() == 0 %}
        <i>Nothing to see here!</i>
    {% else %}
        <ul class="post">
            {% for post in posts %}
                <li>
                    <div>
                        <a class="post" href="/post/{{post.slug}}">
                            <span><b>{{post.title}}</b> — Published: {{post.published}}</span>
                            {% match post.summary %}
                                {% when Some with (summary) %}
                                    <p>{{summary}}</p>
                                {% when None %}
                            {% endmatch %}
                        </a>
                    </div>
                    {% if !loop.last %}
                        <div class="post-hr" />
                    {% endif %}
                </li>
            {% endfor %}
        </ul>
    {% endif %}
{% endblock %}