Last active
June 21, 2019 14:43
-
-
Save savchukoleksii/00681cda4a98a2d57ae15bfe8655900f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% assign previous_article = nil %} | |
{% assign previous_handle = blog.next_article.handle %} | |
{% if previous_handle %} | |
{% assign previous_article = articles[previous_handle] %} | |
{% endif %} | |
{% assign next_article = nil %} | |
{% assign next_handle = blog.previous_article.handle %} | |
{% if next_handle %} | |
{% assign next_article = articles[next_handle] %} | |
{% endif %} | |
{% unless previous_article %} | |
{% assign last_index = blog.articles_count | minus: 1 %} | |
{% assign previous_article = blog.articles[last_index] %} | |
{% endunless %} | |
{% unless next_article %} | |
{% assign next_article = blog.articles[0] %} | |
{% endunless %} | |
{% if previous_article.handle == article.handle %} | |
{% assign previous_article = nil %} | |
{% endif %} | |
{% if next_article.handle == article.handle %} | |
{% assign next_article = nil %} | |
{% endif %} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment