CMS Development

kyl3
Contributeur

Sort filter with pagination

Is there any current work to remedy the sort and then allow pagination out of the box or are hacks still the standard? To be clear when you use the |sort filter, pagination for a blog or assuming any other type of page, break. I think we can use a lazy load instead of pagination but would like both sort and pagination to work together without a hack. That being said does anyone have the code for the hack? Thanks

0 Votes
3 Réponses
piersg
Conseiller clé

Sort filter with pagination

Hi @kyl3, (thanks @sharonlicari) what are you trying to sort by? Date or alphatbetically, or something else?

PWinata
Participant | Partenaire solutions Platinum
Participant | Partenaire solutions Platinum

Sort filter with pagination

Hi @piersg , me too is having the same issue like @kyl3 . Pagination make the sort breaks when we are trying to sort based on updatedDateTime. 
Any thoughts of this? (Of course, without using Hubspot API :D)

{% 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 %}
0 Votes
sharonlicari
Gestionnaire de communauté
Gestionnaire de communauté

Sort filter with pagination

Hi @kyl3 

 

Thank you for reaching out.

 

This link could give you an idea of how to start. I'll also tag a few experts that can share some ideas.

 

Hi @piersg @Anton @tette_engage any thoughts?

 

Thanks

Sharon


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




0 Votes