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">⟶</span></a
 >
 </div>
 </div>
 </div>
 {% endfor %}
 {% endif %}

Is there any thoughts to tackle this ? :slightly_smiling_face:

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 :slightly_smiling_face:
Thanks a lot and have a great day!
Best,
Bérangère

Hi Everyone :slightly_smiling_face:
How are you doing?
have any solutions yet?
we’re stuck :grinning_face_with_smiling_eyes:
Thanks!
Regards,
Putu