{% extends 'Layout/base.html.twig' %}
{% block main %}
{% include '@VisualMediaVisual/Visual/visual.html.twig' with { visuals: [ category ] } %}
<div id="blog_category" class="container">
{% include '@VisualMediaBreadcrumb/Breadcrumb/breadcrumb_static.html.twig' with { breadcrumbs: [
{ title: page.title, path: path('blog_index') },
{ title: category.title },
] } only %}
<h1>{{ category.title }}</h1>
{{ category.htmlContent|scan }}
<hr>
{% if posts is not empty %}
<div class="row">
{% for post in posts %}
<div class="col-4 mb-4">
{#
{% for test in post.mainCategory.posts %}{% endfor %}
{{ dump(post.mainCategory) }}
#}
<h2><a href="{{ path('blog_post', { categorySlug: post.mainCategory.slug, postSlug: post.slug }) }}">{{ post.title }}</a></h2>
<span>Gepubliceerd op: {{ post.publicationDate|date('d-m-Y') }}</span>
<div class="intro-text">
{% set max = 150 %}
{% set content = post.htmlContentIntro|scan %}
{{ (content|length > max ? content|slice(0, max) ~ '...' : content)|raw }}
</div>
<a href="{{ path('blog_post', { categorySlug: post.mainCategory.slug, postSlug: post.slug }) }}">
<img src="{{ post.upload|url }}" style="width: 100%; height: 250px; object-fit: cover;">
</a>
</div>
{% endfor %}
</div>
{% else %}
<p>Er zijn geen berichten gevonden...</p>
{% endif %}
</div>
{% endblock %}