Last active
January 1, 2016 19:29
-
-
Save rruhlen/8190270 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. Allows user to cycle through all articles in current topic.
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> |
We're aware of the 20 articles per topic limitation and have a feature request open to remove the limit.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When the number of articles exceeds 20, any further articles have both "Next" and "Previous" links disabled (the 20th article has just "Next" disabled), so even given a link to—say—the 40th article, the "Next/Previous" links are disabled. Any help getting this to work would be appreciated.