Skip to content

Commit

Permalink
Fix logic to use url rather than title (title is not always unique)
Browse files Browse the repository at this point in the history
  • Loading branch information
katydecorah committed Aug 29, 2023
1 parent a55fe3e commit f605c7d
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions _includes/post/prev-next.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@
{% for category in site.categories %}{% assign catg_name = category.first
%}{% if catg_name == page.categories[0] %}{% assign catg_posts =
category.last %}{% endif %}{% endfor %}{% for post in catg_posts %}{% if
post.title == page.title %}{% unless forloop.last %}{% assign prev =
post.url == page.url %}{% unless forloop.last %}{% assign prev =
catg_posts[forloop.index] %}<a href="{{ prev.url }}" class="post-prev btn">
{% include icons/chevron-left.svg %}
<span class="post-prev-title">Older</span> </a
>{% endunless %}{% endif %}{% assign next = post %}{% endfor %}{% for post
in catg_posts %}{% if post.title == page.title %}{% unless forloop.first
%}<a href="{{ next.url }}" class="post-next btn">
in catg_posts %}{% if post.url == page.url %}{% unless forloop.first %}<a
href="{{ next.url }}"
class="post-next btn"
>
<span class="post-next-title">Newer</span> {% include
icons/chevron-right.svg %}</a
>{% endunless %}{% endif %}{% assign next = post %}{% endfor %}
Expand Down

0 comments on commit f605c7d

Please sign in to comment.