{% extends 'base.html' %}

{% block content %}
    {% if user.is_authenticated and data|length > 0 %}
        {% for d in data %}
            <!-- Post preview-->
            <div class="post-preview">
                <div class="d-flex justify-content-between">
                    <div class="p-2">
                        <a href="{% url 'reader' d.url_id %}">
                            <h2 class="post-title">{% if d.title %}{{ d.title }}{% else %}Без заголовка{% endif %}</h2>
                        </a>
                    </div>
                    <div class="p-2">
                        <a href="{% url 'archive_url' d.url_id %}"><span class="fa-regular fa-square-check"></span></a>
                    </div>
                </div>
                {% if d.short %}
                <p class="post-meta">
                    {{ d.short }}
                </p>
                {% endif %}
                <p class="post-meta">
                    {{ d.url.url|urlizetrunc:70 }}
                </p>
            </div>
            <!-- Divider-->
            <hr class="my-4" />
        {% endfor %}
    {% elif user.is_authenticated %}
        <div class="post-preview">
            <h2 class="post-title">У вас нет сохраненных ссылок</h2>
        </div>
    {% elif not user.is_authenticated %}
        {% include 'about_include.html' %}
        {% include 'faq_include.html' %}
    {% endif %}
{% endblock %}
