Last active
January 1, 2016 20:39
-
-
Save DeskWOW/8198042 to your computer and use it in GitHub Desktop.
How to add "previous article" and "next article" to your Desk.com support center article pages.
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
{% for current_article in topic.articles %} | |
{% if current_processed == true %} | |
{% assign next_article = current_article %} | |
{% assign current_processed = false %} | |
{% endif %} | |
{% if current_article.subject_plain == article.subject_plain %} | |
{% assign current_processed = true %} | |
{% assign previous_article = last_processed %} | |
{% endif %} | |
{% assign last_processed = current_article %} | |
{% endfor %} | |
<br> | |
<hr> | |
{% if previous_article %} | |
<a href="{{ previous_article.public_url }}" title="{{ previous_article.subject_plain }}">Previous Article</a> | |
{% else %} | |
<span style="opacity: 0.5">Previous Article</span> | |
{% endif %} | |
{% if next_article %} | |
<a style="float: right;" href="{{ next_article.public_url }}" title="{{ next_article.subject_plain }}">Next Article</a> | |
{% else %} | |
<span style="float: right; opacity: 0.5">Next Article</span> | |
{% endif %} | |
<hr> | |
<br> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment