{% extends request.ajax ? "layout_blank.html.twig" : "layout_default.html.twig" %}
{% set active_menu = 'news' %}

{% 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'|url }}">{{ '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|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_to_html }}
                </div>
            </div>
            <div class="card-footer">
                <a href="{{ 'news'|url }}" class="btn btn-primary">{{ 'Back to the List'|trans }}</a>
            </div>
        </div>
    </div>
</div>
{% endblock %}
