{% extends request.ajax ? "layout_blank.html.twig" : "layout_default.html.twig" %}

{% block meta_title %}{{ post.title }}{% endblock %}
{% block meta_description %}{{ post.description }}{% endblock %}

{% block body_class %}news-post{% endblock %}
{% block breadcrumb %}
<li class="breadcrumb-item"><a href="{{ 'news' | link}}">{{ 'News'|trans }}</a></li>
<li class="breadcrumb-item active" aria-current="page">{{post.title}}</li>
{% endblock %}

{% block opengraph %}
    <meta property="og:title" content="{{ post.title }}" />
    <meta property="og:type" content="article" />
    <meta property="og:description" content="{{ post.description }}" />
    <meta property="og:url" content="{{ guest.system_current_url }}" />
    <meta property="og:image" content="{{ post.image }}" />
    <meta property="article:author" content="{{ post.author.name }}" />

    {% if post.published_at %}<meta property="article:published_time" content="{{ post.published_at }}" />{% endif %}
    {% if post.updated_at %}<meta property="article:modified_time" content="{{ post.updated_at }}" />{% endif %}
    {% if post.expires_at %}<meta property="article:expiration_time" content="{{ post.expires_at }}" />{% endif %}
    {% if post.section %}<meta property="article:section" content="{{ post.section }}" />{% endif %}
    {% if post.tags %}<meta property="article:tag" content="{{ post.tags|join(', ') }}" />{% endif %}
{% endblock %}

{% block content %}
<div class="row">
    <div class="col-md-12">
        <div class="card ms-0 ms-md-3 w-100">
            <div class="card-header">
                <h3 class="link-body-emphasis mb-1">{{ post.title }}</h3>
                <span class="text-muted">{{ post.updated_at|format_datetime }} {{ 'by'|trans }} {{ post.author.name }}</span>
            </div>
            <div class="card-body">
                <div class="pt-3 px-2">
                    {% if post.image %}<img src="{{ post.image }}" alt="{{ post.title }}">{% endif %}
                    {{ post.content|markdown }}
                    {% if guest.extension_is_on({ "mod": "comment" }) %}{{ include('mod_comment_block.html.twig') }}{% endif %}
                </div>
            </div>
            <div class="card-footer">
                <a href="{{ '/news/'|link }}" class="btn btn-primary">{{ 'Back to the list'|trans }}</a>
            </div>
        </div>
    </div>
</div>
{% endblock %}
