Show relevant page to the current page

How can we get this kind of thing using pagination:


As you can see in the current that now page number 3 is open and now we want to show the page number related to it like 1, 2, 4, 5.

How can we get it?

This is how I do it with one of my themes.

1 Like

Facing a issue. When I hover on page number 1.

It shows this link: page/:num

Rest works perfectly.

But can you explain :stuck_out_tongue_winking_eye: what is happening in these lines of code?

Can someone help me out with this lines of code

      {% assign page_end = paginator.total_pages | minus: 1 %}
      {% if paginator.total_pages < page_end %}
        <span class="page-numbers dots">...</span>

        <a href="/page/{{ paginator.total_pages }}/" class="page-numbers">{{ paginator.total_pages }}</a>
      {% endif %}

I have tuned up the code bit more and now it worked for me. :rofl: