custom/plugins/NetzpBlog6/src/Resources/views/storefront/element/blog-index-card.html.twig line 1

Open in your IDE?
  1. {% block blog_list_item %}
  2.     {% set postDetailUrl = seoUrl('frontend.blog.post', {'postId': post.id} ) %}
  3.     {% set paramPage = app.request.get('p') ? 'p=' ~app.request.get('p') : '' %}
  4.     {% set paramCategory = app.request.get('c') ? 'c=' ~app.request.get('c') : '' %}
  5.     {% set paramAuthor = app.request.get('a') ? 'a=' ~app.request.get('a') : '' %}
  6.     {% set urlParams = [paramPage, paramCategory, paramAuthor] | filter(p => p != '') | join('&') %}
  7.     {% if urlParams %}
  8.         {% set postDetailUrl = postDetailUrl ~ '?' ~ urlParams %}
  9.     {% endif %}
  10.     <div class="col-lg-4 col-sm-6 mb-3">
  11.         {% block blog_list_item_wrapper %}
  12.             <div class="card h-100 blog-card" style="background-color: {{ element.config.backgroundColor.value }}">
  13.                 {% block blog_content_post_inner_image %}
  14.                     {% set image = null %}
  15.                     {% if post.imagepreview %}
  16.                         {% set image = post.imagepreview %}
  17.                     {% elseif post.image %}
  18.                         {% set image = post.image %}
  19.                     {% endif %}
  20.                     {% if image %}
  21.                         {% set thumbnailClass = element.config.imageMode.value == "contain" ? "contain" : "cover" %}
  22.                         <a href="{{ postDetailUrl }}">
  23.                             {% sw_thumbnails 'blog_card_image_thumbnail' with {
  24.                                 media: image,
  25.                                 sizes: {
  26.                                     'xs': '501px',
  27.                                     'sm': '315px',
  28.                                     'md': '427px',
  29.                                     'lg': '333px',
  30.                                     'xl': '284px'
  31.                                 },
  32.                                 attributes: {
  33.                                     'class': 'card-img-top ' ~ thumbnailClass,
  34.                                     'alt':   image.translated.alt ?: '',
  35.                                     'title': post.translated.title ?: ''
  36.                                 }
  37.                             } %}
  38.                         </a>
  39.                     {% else %}
  40.                         <div class="blog-card-paceholder">&nbsp;</div>
  41.                     {% endif %}
  42.                 {% endblock %}
  43.                 <div class="card-body d-flex flex-column p-2">
  44.                     {% block blog_content_post_inner_title %}
  45.                         <a href="{{ postDetailUrl }}">
  46.                             <h4 class="mt-2 mb-0">{{ post.translated.title }}</h4>
  47.                         </a>
  48.                     {% endblock %}
  49.                     {% if element.data.pluginConfig.showmeta %}
  50.                         {% block blog_content_post_inner_meta %}
  51.                             {% sw_include "@Storefront/storefront/page/blog/post-meta.html.twig" with { config: element.data.pluginConfig } %}
  52.                         {% endblock %}
  53.                     {% endif %}
  54.                     {% if post.translated.teaser %}
  55.                         {% block blog_content_post_inner_teaser %}
  56.                             <div class="card-text mt-3 mb-1">
  57.                                 {{ post.translated.teaser }}
  58.                             </div>
  59.                         {% endblock %}
  60.                     {% endif %}
  61.                     {% block blog_content_post_inner_more %}
  62.                         <div class="mt-auto">
  63.                             <a href="{{ postDetailUrl }}"
  64.                                class="btn btn-outline-primary btn-sm mt-2">
  65.                                 {{ "netzp.blog.msg.more"|trans }}
  66.                             </a>
  67.                         </div>
  68.                     {% endblock %}
  69.                 </div>
  70.             </div>
  71.         {% endblock %}
  72.     </div>
  73. {% endblock %}