CMS Development

PWinata
Participant | Platinum Partner
Participant | Platinum Partner

Pagination breaks sorting order

Hi all

I have a blog listing page which required to sort the post based on the updated time. And in this listing, we have a numbered pagination too (based on the one from Boilerplate theme)

However, the sort breaks when reached page 2. 

{% if contents %}
        {% set sorted_contents = contents|sort(True, False, 'updatedDateTime') %}
        {% for content in sorted_contents %}
          <div class="col-12 col-lg-4 mb-4 post-item">
            <div class="card">
              <div class="card-header">
                <a href="{{ content.absolute_url }}">
                  <img src="{{content.featured_image}}" alt="{{ content.name }}" class="card-img" />
                </a>
              </div>
              <div class="card-body">
                <h3 class="card-title">
                  <a href="{{ content.absolute_url }}"
                    >{{ content.name }}</a
                  >
                </h3>
                <p class="card-text">
                  {{ content.post_list_content|striptags|truncate(200, True, "...") }}
                </p>
                <a href="{{ content.absolute_url }}" class="read-more"
                  ><span class="decoration-underline">{{button_caption}}</span>
                  <span class="decoration-none">&#10230;</span></a
                >
              </div>
            </div>
          </div>
        {% endfor %}
      {% endif %}

Is there any thoughts to tackle this ? 🙂

 

0 Upvotes
2 Replies 2
BérangèreL
Community Manager
Community Manager

Pagination breaks sorting order

Hi @PWinata,

Thank you for sharing the code and for asking the Community!

I'd like to invite a couple of subject matter experts to this conversation: Hi @Teun, @BarryGrennan, @eyeson and @ChehakWadhdwa do you have tips to help @PWinata, please?

Also, if anybody else has anything to add and/or share, please feel free to join in the conversation 🙂

Thanks a lot and have a great day!

Best,
Bérangère


Saviez-vous que la Communauté est disponible en Français ?
Rejoignez les discussions francophones en changeant votre langue dans les paramètres !

Did you know that the Community is available in other languages?
Join regional conversations by changing your language settings!


0 Upvotes
PWinata
Participant | Platinum Partner
Participant | Platinum Partner

Pagination breaks sorting order

Hi Everyone 🙂
How are you doing?

have any solutions yet?
we're stuck 😄

Thanks!
Regards,
Putu
0 Upvotes