{% set shouldPaginate = 0 %}
<section class="blog-page pad-tb">
<div class="container">
<div class="row">
<div class="col-lg-8">
<div class="pr--100">
{% for data in posts %}
{% if data.content.blocks and data.getPublishedAt %}
{% set shouldPaginate = shouldPaginate + 1 %}
{% if data.content.blocks[0].type is same as("image") %}
{% set image = data.content.blocks[0].data.file.url %}
{% else %}
{% set image = "null" %}
{% endif %}
{% include('partials/card/blog-card-bg.html.twig') with {
title: data.title ,
url: path('blog_post' , {
slug: data.slug ,
}) ,
image: image,
author: "admin",
paragraph: data.content.blocks|filter(block => block.type == "paragraph")|map(block => "#{block.data.text}")|join(" "),
categories: data.categories.unwrap
} %}
{% endif %}
{% endfor %}
{% if shouldPaginate is not same as(0) %}
{{ pagerfanta(posts) }}
{% endif %}
</div>
</div>
{% include('partials/_sidebar.html.twig') %}
</div>
</div>
</section>