2023-04-10 05:54:27 +03:00
|
|
|
<!-- The paginator for post list on HomgPage. -->
|
2020-02-22 02:09:09 +03:00
|
|
|
|
2023-06-28 15:21:30 +03:00
|
|
|
<ul class="pagination align-items-center mt-4 mb-1 ps-lg-2">
|
2020-02-22 02:09:09 +03:00
|
|
|
<!-- left arrow -->
|
|
|
|
{% if paginator.previous_page %}
|
2020-10-27 11:20:22 +03:00
|
|
|
{% assign prev_url = paginator.previous_page_path | relative_url %}
|
|
|
|
{% else %}
|
2023-04-10 05:54:27 +03:00
|
|
|
{% assign prev_url = '#' %}
|
2020-10-27 11:20:22 +03:00
|
|
|
{% endif %}
|
2021-05-19 06:09:52 +03:00
|
|
|
|
2020-10-27 11:20:22 +03:00
|
|
|
<li class="page-item {% unless paginator.previous_page %}disabled{% endunless %}">
|
|
|
|
<a class="page-link btn-box-shadow" href="{{ prev_url }}" aria-label="previous-page">
|
2020-02-22 02:09:09 +03:00
|
|
|
<i class="fas fa-angle-left"></i>
|
|
|
|
</a>
|
|
|
|
</li>
|
|
|
|
|
|
|
|
<!-- page numbers -->
|
|
|
|
{% assign left_ellipsis = false %}
|
|
|
|
{% assign right_ellipsis = false %}
|
|
|
|
|
|
|
|
{% for i in (1..paginator.total_pages) %}
|
|
|
|
{% assign pre = paginator.page | minus: 1 %}
|
|
|
|
{% assign next = paginator.page | plus: 1 %}
|
|
|
|
{% assign pre_less = pre | minus: 1 %}
|
|
|
|
{% assign next_more = next | plus: 1 %}
|
|
|
|
{% assign show = false %}
|
|
|
|
|
|
|
|
{% if paginator.page == 1 %}
|
|
|
|
{% if i <= 3 or i == paginator.total_pages %}
|
|
|
|
{% assign show = true %}
|
|
|
|
{% endif %}
|
|
|
|
{% elsif paginator.page == paginator.total_pages %}
|
|
|
|
{% if i == 1 or i >= pre_less %}
|
|
|
|
{% assign show = true %}
|
|
|
|
{% endif %}
|
|
|
|
{% else %}
|
2023-04-10 05:54:27 +03:00
|
|
|
{% if i == 1 or i == paginator.total_pages %}
|
2020-02-22 02:09:09 +03:00
|
|
|
{% assign show = true %}
|
|
|
|
{% elsif i >= pre and i <= next %}
|
|
|
|
{% assign show = true %}
|
|
|
|
{% endif %}
|
|
|
|
{% endif %}
|
|
|
|
|
|
|
|
{% if show %}
|
2020-10-27 11:20:22 +03:00
|
|
|
<!-- show number -->
|
|
|
|
<li class="page-item {% if i == paginator.page %} active{% endif %}">
|
2023-04-10 05:54:27 +03:00
|
|
|
<a
|
|
|
|
class="page-link btn-box-shadow"
|
|
|
|
href="{% if i > 1 %}{{ site.paginate_path | replace: ':num', i | relative_url }}{% else %}{{ '/' | relative_url }}{% endif %}"
|
|
|
|
>
|
|
|
|
{{- i -}}
|
|
|
|
</a>
|
2020-10-27 11:20:22 +03:00
|
|
|
</li>
|
|
|
|
{% else %}
|
|
|
|
<!-- hide number -->
|
|
|
|
{% if i < pre and left_ellipsis == false %}
|
|
|
|
<li class="page-item disabled">
|
|
|
|
<span class="page-link btn-box-shadow">...</span>
|
|
|
|
</li>
|
|
|
|
{% assign left_ellipsis = true %}
|
|
|
|
{% elsif i > next and right_ellipsis == false %}
|
|
|
|
<li class="page-item disabled">
|
|
|
|
<span class="page-link btn-box-shadow">...</span>
|
2020-02-22 02:09:09 +03:00
|
|
|
</li>
|
2020-10-27 11:20:22 +03:00
|
|
|
{% assign right_ellipsis = true %}
|
2020-02-22 02:09:09 +03:00
|
|
|
{% endif %}
|
2020-10-27 11:20:22 +03:00
|
|
|
{% endif %}
|
2020-02-22 02:09:09 +03:00
|
|
|
{% endfor %}
|
|
|
|
|
2021-05-19 06:09:52 +03:00
|
|
|
<!-- mobile pagination -->
|
|
|
|
<li class="page-index align-middle">
|
|
|
|
<span>{{ paginator.page }}</span>
|
|
|
|
<span class="text-muted">/ {{ paginator.total_pages }}</span>
|
|
|
|
</li>
|
|
|
|
|
2020-02-22 02:09:09 +03:00
|
|
|
<!-- right arrow -->
|
2020-10-27 11:20:22 +03:00
|
|
|
{% if paginator.next_page_path %}
|
|
|
|
{% assign next_url = paginator.next_page_path | relative_url %}
|
|
|
|
{% else %}
|
2023-04-10 05:54:27 +03:00
|
|
|
{% assign next_url = '#' %}
|
2020-10-27 11:20:22 +03:00
|
|
|
{% endif %}
|
2021-05-19 06:09:52 +03:00
|
|
|
|
2020-10-27 11:20:22 +03:00
|
|
|
<li class="page-item {% unless paginator.next_page_path %}disabled{% endunless %}">
|
|
|
|
<a class="page-link btn-box-shadow" href="{{ next_url }}" aria-label="next-page">
|
2020-02-22 02:09:09 +03:00
|
|
|
<i class="fas fa-angle-right"></i>
|
|
|
|
</a>
|
|
|
|
</li>
|
2023-04-10 05:54:27 +03:00
|
|
|
</ul>
|
|
|
|
<!-- .pagination -->
|