{% extends 'base.html.twig' %}
{# Write blog post information #}
{% set newsDetail = [] %}
{# Match blog post information #}
{% for newsItem in news %}
{% if newsItem.slug == slug and newsItem.active %}
{% set newsDetail = {
"publishDate": newsItem.publishDate,
"author": newsItem.author,
"image": newsItem.image,
"title": newsItem.title,
"text": newsItem.text
} %}
{% endif %}
{% endfor %}
{# Replace some markdown #}
{% set text = newsDetail.text|markdown_to_html|replace({ '<p><strong>': '<h2>', '</strong></p>': '</h2>' }) %}
{# Overwrite title #}
{% block head %}
{% embed 'layout/head.html.twig' %}
{% block head_title_title %}<title>{{ newsDetail.title }} - CTC</title>{% endblock %}
{% block head_previews_ogtitle %}<meta property="og:title" content="{{ newsDetail.title }}">{% endblock %}
{% block head_previews_ogdescription %}<meta property="og:description" content="{{ newsDetail.text|markdown_to_html|striptags|u.truncate(140, '...') }}">{% endblock %}
{% block head_previews_ogurl %}<meta property="og:url" content="https://www.ctc-rheda.de/news/{{ slug }}">{% endblock %}
{% block head_links_canonical %}<link rel="canonical" href="https://www.ctc-rheda.de/news/{{ slug }}" />{% endblock %}
{% endembed %}
{% endblock %}
{# News detail #}
{% block content %}
{# Content #}
<section class="section--content">
<div class="section--inner">
<div class="row justify-content--center">
<div class="col col-12 col-xs-10 col-m-9 col-l-7">
<div class="col-inner">
<h1 class="tb2 tb3-m color--black">{{ newsDetail.title }}</h1>
<p class="blog-info is--bold">{{ newsDetail.publishDate|date("d.m.Y") }} - {{ newsDetail.author }}</p>
</div>
</div>
<div class="col col-12 col-xs-10 col-m-9 col-l-7">
<div class="col-inner">
{% if newsDetail.image.path is defined %}
<img class="news--banner" src="https://api.ctc-rheda.de/{{ newsDetail.image.path }}">
{% else %}
<img class="news--banner" src="https://api.ctc-rheda.de/news/ctc-general.png">
{% endif %}
</div>
</div>
<div class="col col-12 col-xs-10 col-m-9 col-l-7">
<div class="col-inner">
<div class="news--content">
{{ text|markdown_to_html }}
</div>
</div>
</div>
<div class="col col-12 col-xs-10 col-m-9 col-l-7">
<div class="col-inner">
<a class="btn" href="{{ path('news_index') }}">Zurück zu allen Neuigkeiten</a>
</div>
</div>
</div>
</div>
</section>
{% endblock %}