Hi,
I’d like to fix this issue we’re having on our company’s site.
If you compare the Italian (original) blog page with English blog page, you’ll see that pagination on the English blog is not correct. There are pages with 1 or 2 articles, and others with 6-8 articles.
Apparently, the blog page uses the Italian pagination and then simply shows empty slots if an Italian article hasn’t been translated to English.
This is the code of blog.html.twig. Any help will be appreciated.
{% extends 'partials/base.html.twig' %}
{% block content %}
{% include 'partials/banner2.html.twig' %}
<!-- Search box -->
<div class="container">
<div class="row">
<div class="col-lg-12 col-md-12">
{{ content|raw }}
</div>
</div>
<div class="row">
<div class="col-lg-12 col-md-12">
{% include 'partials/simplesearch_searchbox.html.twig' %}
</div>
</div>
</div>
<!-- ============================ Blog Grid Start ================================== -->
{% set collection = page.collection() %}
<section>
<div class="container">
<div class="row">
{% for child in collection %}
{% if child.language == grav.language.getLanguage %}
<!-- Single Blog Grid -->
<div class="col-lg-6 col-md-6">
<div class="blog-grid-wrap mb-4">
<div class="blog-grid-thumb">
<a href="{{ child.url }}">
<img src="{{ child.media.images|first.url() }}" class="img-responsive" alt="" />
</a>
<div class="bg-cat-info">
<h6>{% for cat in child.header.taxonomy.category %}{{ cat }}{% if not loop.last %},{% endif %} {% endfor %}</h6>
<span>{{ child.header.date|date('d') }} {{ 'GRAV.MONTHS_OF_THE_YEAR'|ta(child.header.date|date('n') - 1) }} {{ child.header.date|date('Y') }}</span>
</div>
</div>
<div class="blog-grid-content">
<h4 class="cnt-gb-title">
<a href="{{ child.url }}">{{ child.title }}</a>
</h4>
<p>{{ child.summary(110)|striptags }}</p>
</div>
<div class="blog-grid-meta">
<div class="gb-info-author">
<p><i class="fa fa-user-circle-o"></i> {% for author in child.taxonomy.author %}{{ author }}{% if not loop.last %},{% endif %} {% endfor %} <span class="reading-time"> <i class="fa fa-clock-o"></i> {{ child.content|readingtime }}</span></p>
</div>
</div>
</div>
</div>
{% endif %}
{% endfor %}
</div>
<div class="row">
<div class="col-md-12">
<div class="bs-example">
{% include 'partials/pagination.html.twig' with {'base_url':page.url, 'pagination':collection.params.pagination} %}
</div>
</div>
</div>
</div>
</section>
<div class="clearfix"></div>
<!-- ============================ Blog Grid End ================================== -->
{% endblock %}
I’d like to have 8 articles on each page, regardless of the language. So, page 1 of the English blog should show the latest 8 English articles, even though these articles don’t match the Italian ones.
I hope it’s clear. If it isn’t, I’ll be happy to explain further.
Thanks in advance,
Marco