Skip to content

Instantly share code, notes, and snippets.

@Stanko
Stanko / custom-jekyll-pagination
Last active July 25, 2023 11:22
Custom Jekyll pagination
{% if paginator.total_pages > 1 %}
{% assign start = paginator.page | minus: 2 %}
{% assign end = paginator.page | plus: 2 %}
{% if start < 1 %}
{% assign start = 1 %}
{% assign end = start | plus: 4 %}
{% elsif end > paginator.total_pages %}
{% assign start = paginator.total_pages | minus: 4 %}