{% extends 'base.html' %}
{% load i18n %}
{% load helper_tags %}
{% get_current_language as LANGUAGE_CODE %}
{% block languagecode %}
    {{ LANGUAGE_CODE }}
{% endblock languagecode %}
{% block title %}
    {% translate "cscherr.de" %} - {% translate "Blog" %}
{% endblock title %}
{% block nav %}
    {% include 'nav.html' %}
{% endblock nav %}
{% block head %}
    <script type="text/javascript"
            id="MathJax-script"
            async
            src="https://cdn.jsdelivr.net/npm/mathjax@3.0.0/es5/tex-mml-chtml.js"></script>
{% endblock head %}
{% block main %}
    <div class="container-xl">
        <article>
            <div class="jumbotron my-5">
                <div class="row">
                    <div class="col">
                        <picture>
                            <img src="{{ post.thumbnail.url }}" alt="thumbnail" class="img-fluid">
                        </picture>
                    </div>
                    <div class="col">
                        <div class="row py-5">
                            {% if LANGUAGE_CODE == "de" %}
                                <h1 class="">
                                    {{ post.title_de }}
                                    <br>
                                    <small class="fs-4">{{ post.subtitle_de }}</small>
                                </h1>
                                <br>
                            {% elif LANGUAGE_CODE == "en" %}
                                <h1 class="">
                                    {{ post.title_en }}
                                    <br>
                                    <small class="fs-4">{{ post.subtitle_en }}</small>
                                </h1>
                                <br>
                            {% else %}
                                <h1 class="">
                                    {{ post.title_en }}
                                    <br>
                                    <small class="fs-4">{{ post.subtitle_en }}</small>
                                </h1>
                                <br>
                            {% endif %}
                        </div>
                        <div class="row py-5">
                            {% if LANGUAGE_CODE == "de" %}
                                <p class="lead">{{ post.desc_de }}</p>
                            {% elif LANGUAGE_CODE == "en" %}
                                <p class="lead">{{ post.desc_en }}</p>
                            {% else %}
                                <p class="lead">{{ post.desc_en }}</p>
                            {% endif %}
                        </div>
                        <div class="row py-5">
                            <p>
                                <b>{{ post.category.name }}<b>
                                </p>
                            </div>
                        </div>
                    </div>
                </div>
                <hr>
                <div class="my-5">
                    {% if LANGUAGE_CODE == "de" %}
                        {{ post.body_de | safe }}
                    {% elif LANGUAGE_CODE == "en" %}
                        {{ post.body_en | safe }}
                    {% else %}
                        {{ post.body_en | safe }}
                    {% endif %}
                </div>
                <hr>
                <div class="row text-center">
                    <div class="col">
                        {% format_time post.date as date %}
                        <p>{% trans "published" %}: {{ date }}</p>
                    </div>
                    <div class="col">
                        {% format_time post.update as update %}
                        <p>{% trans "updated" %}: {{ update }}</p>
                    </div>
                </div>
            </article>
        </div>
        {% include 'blog/featured.html' %}
    {% endblock main %}
