{% if page.categories %}

{% assign currentCat = page.categories[0] %}
{% assign links = site.docs | sort: 'order' | where: 'category', currentCat %}

{% endif %}

{% for link in links %}

{% if link.title == page.title %}
    {% unless forloop.first %}
        {% assign prev = tmpprev %}
    {% endunless %}
    {% unless forloop.last %}
        {% assign next = links[forloop.index] %}
    {% endunless %}
{% endif %}
{% assign tmpprev = link %}

{% endfor %} <nav class=“docs__pagination”>

    {% if prev %}
    <a class="docs__pagination-item docs__pagination-item--prev" href="{{ prev.url}}" title="{{ prev.title }}">
        {{ prev.title }}
    </a>
{% endif %}
    {% if next %}
    <a class="docs__pagination-item docs__pagination-item--next" href="{{ next.url}}">
        {{ next.title }}
    </a>
{% endif %}

</nav>