I have a problemin the code of my blog, but I cannot find how to solve it.
When we go to the second page of the listing, the two items are duplicated. they have no been created twice in the editor. It would come from the code.
Has anyone ever had this?
Here is my code:
<div class="top-blog" style="background-image: url('https://f.hubspotusercontent20.net/hubfs/5974320/Blog/KI%20FR%20-%20Banni%C3%A8re%20Blog.png')">
<h1 class="page-center content-wrapper">
KIsolation
</h1>
</div>
{% if not topic %}
<div class="page-center content-wrapper">
{# TOP POST // ARTICLE A LA UNE #}
{% set posts = blog_recent_posts('default', 1) %}
{% for post in posts %}
<div class="bl-top-post">
<div class="bl-top-post-inner">
<div class="bl-top-post-img">
<a href="{{ content.absolute_url }}"><img src="{{ resize_image_url( post.post_list_summary_featured_image,690 ) }}" class="hs-featured-image"></a>
</div>
<div class="bl-top-post-content">
{% if post.topic_list %}
<div class="bl-top-content-cat">
{% for tag in post.tag_list %} {# {% set t = t + 1 %} {% if t == 1 %} #}
<a class="topic-link" href="{{ blog_tag_url(group.id, tag.slug) }}">{{ tag.name }}</a>
{# {% endif %} #} {% endfor %}
<p><date>{{ post.publish_date_localized }}</date></p>
</div>
{% endif %}
<h2><a href="{{post.absolute_url}}">{{ post.name }}</a></h2>
<div class="bl-top-post-description">
{{ post.post_list_content|safe|truncatehtml(200, ' ' ) }}
</div>
<div class="post-description-btn">
<a class="more-btn" href="{{ post.absolute_url }}">Lire l'article </a>
</div>
</div>
</div>
</div>
{% endfor %}
{% endif %}
<div class="blog-section container">
<div class="blog-listing-wrapper cell-wrapper">
<div class="blog-section">
<div class="blog-listing-wrapper cell-wrapper">
<div class="">
{% if topic %}
<div class="topic-title">
<h2>Articles : <span>{{ topic|replace('-',' ') }}</span></h2>
</div>
{% endif %}
{# simple_list_page indicates the "blog/all" page, which is a list of links to every blog post #}
<div class="post-listing">
{% for content in contents %}
<div class="post-item">
<div class="post-inner">
<div class="hs-featured-image-wrapper" style="background: url({{ resize_image_url( content.post_list_summary_featured_image,400 ) }}) no-repeat; background-size:cover; ">
{% for tag in content.tag_list %} {% set t = t + 1 %} {% if t == 1 %}
<a class="topic-link tag-link" href="{{ blog_tag_url(group.id, tag.slug) }}">{{ tag.name }}</a> {% endif %} {% endfor %}
</div>
<div class="post-header">
<div class="date">
<date>{{ content.publish_date_localized }}</date>
</div>
<h2><a href="{{content.absolute_url}}">{{ content.name }}</a></h2>
<p>{{ content.post_summary|striptags|truncate(120, breakword=False, end='...') }}</p>
<div class="post-description-btn">
<a class="more-btn" href="{{ content.absolute_url }}">Lire l'article </a>
</div>
</div>
</div>
</div>
{% if current_page_num > 1 %}
<div class="post-item">
<div class="post-inner">
<div class="hs-featured-image-wrapper" style="background: url({{ resize_image_url( content.post_list_summary_featured_image,400 ) }}) no-repeat; background-size:cover; ">
{% for tag in content.tag_list %} {% set t = t + 1 %} {% if t == 1 %}
<a class="topic-link tag-link" href="{{ blog_tag_url(group.id, tag.slug) }}">{{ tag.name }}</a> {% endif %} {% endfor %}
</div>
<div class="post-header">
<div class="date">
<date>{{ content.publish_date_localized }}</date>
</div>
<h2><a href="{{content.absolute_url}}">{{ content.name }}</a></h2>
<p>{{ content.post_summary|striptags|truncate(120, breakword=False, end='...') }}</p>
<div class="post-description-btn">
<a class="more-btn" href="{{ content.absolute_url }}">Lire l'article </a>
</div>
</div>
</div>
</div>
{% endif %}
{% if simple_list_page %}
{% if loop.first %}
<h2><br></h2>
{% endif %}
<h2 class="post-listing-simple"><a href="{{content.absolute_url}}">{{ content.name }}</a></h2>
{% endif %}
{% endfor %}
</div>
</div>
{% if not simple_list_page %}
<div class="blog-pagination">
{% set page_list = [-2, -1, 0, 1, 2] %}
{% if contents.total_page_count - current_page_num == 1 %}{% set offset = -1 %}
{% elif contents.total_page_count - current_page_num == 0 %}{% set offset = -2 %}
{% elif current_page_num == 2 %}{% set offset = 1 %}
{% elif current_page_num == 1 %}{% set offset = 2 %}
{% else %}{% set offset = 0 %}{% endif %}
{% if last_page_num %}
<a class="prev-link" href="{{ blog_page_link(last_page_num) }}">Précédente</a>
{% endif %}
{% for page in page_list %}
{% set this_page = current_page_num + page + offset %}
{% if this_page > 0 and this_page <= contents.total_page_count %}
<a {% if this_page == current_page_num %}class="active"{% endif %} href="{{ blog_page_link(this_page) }}">{{ this_page }}</a>
{% endif %}
{% endfor %}
{% if next_page_num %}<a class="next-link" href="{{ blog_page_link(current_page_num + 1) }}">Suivante</a>{% endif %}
</div>
{% endif %}
</div>
</div>
</div>
</div>
</div>
After you " {% if current_page_num > 1 %}" expression you're printing the blog post for the second time. The first happening int he block just above this..
I think you would need to reevaluate your conditionals to find your solution.
After you " {% if current_page_num > 1 %}" expression you're printing the blog post for the second time. The first happening int he block just above this..
I think you would need to reevaluate your conditionals to find your solution.
HubSpot’s AI-powered customer agent resolves up to 50% of customer queries instantly, with some customers reaching up to 90% resolution rates. Learn More.