{# Prev / Next Link -------------------------------------------------- {{ macroPostNav.postNav(entry, 'work', 'postDate', 'prev work', 'next work' ) }} #} {% macro postNav(entry, section, order, prevLabel, nextLabel, prevIcon, nextIcon) %} {# Set vars #} {% set section = section|default('blog') %} {% set order = order|default('postDate') %} {% set prevLabel = prevLabel|default(false) %} {% set nextLabel = nextLabel|default(false) %} {% set prevIcon = prevIcon|default(false) %} {% set nextIcon = nextIcon|default(false) %} {# Set parameters for prev/next elements list #} {% set data = craft.entries.section(section).order(order).limit(null) %} {# Get the prev/next elements #} {% set prevEntry = entry.getPrev(data) %} {% set nextEntry = entry.getNext(data) %} {# And make sure to only output the links if the element exists #} {% if prevEntry or nextEntry %} {% endif %} {% endmacro %}