Skip to content

Commit

Permalink
Tries to fix pagination for Changelog
Browse files Browse the repository at this point in the history
  • Loading branch information
holm10 committed Jan 3, 2024
1 parent b3a295b commit 8c8e467
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 1 deletion.
2 changes: 1 addition & 1 deletion _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ plugins:
include: ['_pages']

paginate: 6
paginate_path: /page:num/
paginate_path: _posts/page:num/

# Exclude these files from your production _site
exclude:
Expand Down
49 changes: 49 additions & 0 deletions _posts/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
---
layout: default
---

<div class="posts">
{% for post in paginator.posts %}
<article class="post">
<a href="{{ site.baseurl }}{{ post.url }}">
<h1>{{ post.title }}</h1>

<div>
<p class="post_date">{{ post.date | date: "%B %e, %Y" }}</p>
</div>
</a>
<div class="entry">
{{ post.excerpt }}
</div>

<a href="{{ site.baseurl }}{{ post.url }}" class="read-more">Read More</a>
</article>
{% endfor %}

<!-- pagination -->
{% if paginator.total_pages > 1 %}
<div class="pagination">
{% if paginator.previous_page %}
<a href="{{ paginator.previous_page_path | prepend: site.baseurl | replace: '//', '/' }}">&laquo; Prev</a>
{% else %}
<span>&laquo; Prev</span>
{% endif %}

{% for page in (1..paginator.total_pages) %}
{% if page == paginator.page %}
<span class="webjeda">{{ page }}</span>
{% elsif page == 1 %}
<a href="{{ '/' | prepend: site.baseurl | replace: '//', '/' }}">{{ page }}</a>
{% else %}
<a href="{{ site.paginate_path | prepend: site.baseurl | replace: '//', '/' | replace: ':num', page }}">{{ page }}</a>
{% endif %}
{% endfor %}

{% if paginator.next_page %}
<a href="{{ paginator.next_page_path | prepend: site.baseurl | replace: '//', '/' }}">Next &raquo;</a>
{% else %}
<span>Next &raquo;</span>
{% endif %}
</div>
{% endif %}
</div>

0 comments on commit 8c8e467

Please sign in to comment.