templates/pages/news-detail.html.twig line 1

Open in your IDE?
  1. {% extends 'base.html.twig' %}
  2. {# Write blog post information #}
  3. {% set newsDetail = [] %}
  4. {# Match blog post information #}
  5. {% for newsItem in news %}
  6.     {% if newsItem.slug == slug and newsItem.active %}
  7.         {% set newsDetail = {
  8.             "publishDate": newsItem.publishDate,
  9.             "author": newsItem.author,
  10.             "image": newsItem.image,
  11.             "title": newsItem.title,
  12.             "text": newsItem.text
  13.         } %}
  14.     {% endif %}
  15. {% endfor %}
  16. {# Replace some markdown #}
  17. {% set text = newsDetail.text|markdown_to_html|replace({ '<p><strong>': '<h2>', '</strong></p>': '</h2>' }) %}
  18. {# Overwrite title #}
  19. {% block head %}
  20.     {% embed 'layout/head.html.twig' %}
  21.         {% block head_title_title %}<title>{{ newsDetail.title }} - CTC</title>{% endblock %}
  22.         {% block head_previews_ogtitle %}<meta property="og:title" content="{{ newsDetail.title }}">{% endblock %}
  23.         {% block head_previews_ogdescription %}<meta property="og:description" content="{{ newsDetail.text|markdown_to_html|striptags|u.truncate(140, '...') }}">{% endblock %}
  24.         {% block head_previews_ogurl %}<meta property="og:url" content="https://www.ctc-rheda.de/news/{{ slug }}">{% endblock %}
  25.         {% block head_links_canonical %}<link rel="canonical" href="https://www.ctc-rheda.de/news/{{ slug }}" />{% endblock %}
  26.     {% endembed %}
  27. {% endblock %}
  28. {# News detail #}
  29. {% block content %}
  30.     {# Content #}
  31.     <section class="section--content">
  32.         <div class="section--inner">
  33.             <div class="row justify-content--center">
  34.                 <div class="col col-12 col-xs-10 col-m-9 col-l-7">
  35.                     <div class="col-inner">
  36.                         <h1 class="tb2 tb3-m color--black">{{ newsDetail.title }}</h1>
  37.                         <p class="blog-info is--bold">{{ newsDetail.publishDate|date("d.m.Y") }} - {{ newsDetail.author }}</p>
  38.                     </div>
  39.                 </div>
  40.                 <div class="col col-12 col-xs-10 col-m-9 col-l-7">
  41.                     <div class="col-inner">
  42.                         {% if newsDetail.image.path is defined %}
  43.                             <img class="news--banner" src="https://api.ctc-rheda.de/{{ newsDetail.image.path }}">
  44.                         {% else %}
  45.                             <img class="news--banner" src="https://api.ctc-rheda.de/news/ctc-general.png">
  46.                         {% endif %}
  47.                     </div>
  48.                 </div>
  49.                 <div class="col col-12 col-xs-10 col-m-9 col-l-7">
  50.                     <div class="col-inner">
  51.                         <div class="news--content">
  52.                             {{ text|markdown_to_html }}
  53.                         </div>
  54.                     </div>
  55.                 </div>
  56.                 <div class="col col-12 col-xs-10 col-m-9 col-l-7">
  57.                     <div class="col-inner">
  58.                         <a class="btn" href="{{ path('news_index') }}">Zurück zu allen Neuigkeiten</a>
  59.                     </div>
  60.                 </div>
  61.             </div>
  62.         </div>
  63.     </section>
  64. {% endblock %}