{% if element.data.result is empty %}
<div class="cms-listing-col col-12">
{% sw_include '@Storefront/storefront/utilities/alert.html.twig' with {
type: 'info', content: 'netzp.blog.msg.noposts'|trans|sw_sanitize
} %}
</div>
{% else %}
<div class="blog-slider"
data-product-slider="true"
data-product-slider-options='{
"slider": {
"gutter": 20,
"autoplayButtonOutput": false,
"nav": false,
"controls": true,
"autoplay": false,
"mouseDrag": true
}
}'>
<div class="row blog-slider-container m-0 p-0" data-product-slider-container="true">
{% for post in element.data.result %}
{% set postDetailUrl = seoUrl('frontend.blog.post', {'postId': post.id} ) %}
{% set paramPage = app.request.get('p') ? 'p=' ~ app.request.get('p') : '' %}
{% set paramCategory = app.request.get('c') ? 'c=' ~ app.request.get('c') : '' %}
{% set paramAuthor = app.request.get('a') ? 'a=' ~ app.request.get('a') : '' %}
{% set urlParams = [paramPage, paramCategory, paramAuthor] | filter(p => p != '') | join('&') %}
{% if urlParams %}
{% set postDetailUrl = postDetailUrl ~ '?' ~ urlParams %}
{% endif %}
<div>
<div class="card blog-card h-100" style="background-color: {{ element.config.backgroundColor.value }}">
{% set image = null %}
{% if post.imagepreview %}
{% set image = post.imagepreview %}
{% elseif post.image %}
{% set image = post.image %}
{% endif %}
{% if image %}
{% set thumbnailClass = element.config.imageMode.value == "contain" ? "contain" : "cover" %}
<a href="{{ postDetailUrl }}">
{% if image.mediaType.name == 'IMAGE' %}
{% sw_thumbnails 'blog_slider_image_thumbnail' with {
media: image,
sizes: {
'xs': '501px',
'sm': '315px',
'md': '427px',
'lg': '333px',
'xl': '284px'
},
attributes: {
'class': 'card-img-top ' ~ thumbnailClass,
'alt': image.translated.alt ?: '',
'title': post.translated.title ?: ''
}
} %}
{% elseif image.mediaType.name == 'VIDEO' %}
<video class="video" controls>
<source src="{{ image.url }}" type="{{ image.mimetype }}">
Your browser does not support HTML5 video.
</video>
{% endif %}
</a>
{% else %}
<div class="blog-card-paceholder"> </div>
{% endif %}
<div class="card-body d-flex flex-column p-2">
{% block blog_content_post_inner_title %}
<a href="{{ postDetailUrl }}">
<h4 class="mt-2 mb-0">{{ post.translated.title }}</h4>
</a>
{% endblock %}
{% if element.data.pluginConfig.showmeta %}
{% block blog_content_post_inner_meta %}
{% sw_include "@Storefront/storefront/page/blog/post-meta.html.twig" with { config: element.data.pluginConfig } %}
{% endblock %}
{% endif %}
{% if post.translated.teaser %}
{% block blog_content_post_inner_teaser %}
<div class="card-text mt-3 mb-1">
{{ post.translated.teaser }}
</div>
{% endblock %}
{% endif %}
{% block blog_content_post_inner_more %}
<div class="mt-auto">
<a href="{{ postDetailUrl }}"
class="btn btn-outline-primary btn-sm mt-2">
{{ "netzp.blog.msg.more"|trans }}
</a>
</div>
{% endblock %}
</div>
</div>
</div>
{% endfor %}
</div>
<div class="blog-slider-controls-container">
<div class="base-slider-controls"
data-product-slider-controls="true">
<button class="base-slider-controls-prev product-slider-controls-prev">
{% sw_icon 'arrow-head-left' %}
</button>
<button class="base-slider-controls-next product-slider-controls-next">
{% sw_icon 'arrow-head-right' %}
</button>
</div>
</div>
</div>
{% endif %}