Skip to content

Commit

Permalink
update layout
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisguida committed Aug 29, 2024
1 parent 02c5822 commit 40492fb
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions _layouts/default.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,22 @@
</article>

<nav class="pagination">
{% assign pages = site.pages | sort: 'order' %}
{% for p in pages %}
{% assign pages_sorted = site.pages | sort: 'order' %}
{% assign current_index = nil %}

{% for p in pages_sorted %}
{% if p.url == page.url %}
{% assign current_index = forloop.index0 %}
{% endif %}
{% endfor %}
{% if current_index > 0 %}
{% assign previous_page = pages[current_index | minus: 1] %}

{% if current_index and current_index > 0 %}
{% assign previous_page = pages_sorted[current_index | minus: 1] %}
<a href="{{ previous_page.url }}" class="btn btn-primary">&laquo; Previous: {{ previous_page.title }}</a>
{% endif %}
{% if current_index < pages.size %}
{% assign next_page = pages[current_index | plus: 1] %}

{% if current_index and current_index < pages_sorted.size %}
{% assign next_page = pages_sorted[current_index | plus: 1] %}
<a href="{{ next_page.url }}" class="btn btn-primary">Next: {{ next_page.title }} &raquo;</a>
{% endif %}
</nav>
Expand Down

0 comments on commit 40492fb

Please sign in to comment.