<p>Make sure you are using</p>

<pre><code>.limit(null)
</code></pre>

<p>In your element criteria model </p>

CC BY-SA 3.0
2016-04-23T20:25:04.103Z
2016-04-23T20:25:04.103Z
Patrick Harrington
<p>I've this macro:</p>

<pre><code>{{ dh_macros.dh_postNav(entry, 'blog', 'postDate', 'prev article', 'next article') }}
</code></pre>

<p>I call it on my blog/_single template and it works for 90% of the posts. But the newest 6 posts doesn't show the next / prev links.</p>

<p><a href="https://i.sstatic.net/isFji.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/isFji.png" alt="enter image description here"></a></p>

<p>This is the last post how it works fine. In the next newer post it looks like this:
<a href="https://i.sstatic.net/hecaq.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/hecaq.png" alt="enter image description here"></a></p>

<p>Here is the next post link missing. And one post newer there is no link shown neither next nor prev :/</p>

<p>To appreciation, there are next / prev posts there.</p>

<p>It feels really random and I've no idea what's going wrong. 
Maybe someone has an idea. </p>

<p>Thanks!</p>

<p>Here the Full Code maybe someone need it:</p>

<pre><code>{#
    Prev / Next Link
    Examples:

    {{ dh_macros.dh_postNav(entry, 'work', 'postDate', 'prev work', 'next work' ) }}
#}

    {% macro dh_postNav(entry, section, order, prevLabel, nextLabel ) %}

    {# Set vars #}
    {% set section     = section|default('blog') %}
    {% set order       = order|default('postDate') %}
    {% set prevLabel   = prevLabel|default(false) %}
    {% set nextLabel   = nextLabel|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 %}

        &lt;ul class="postNav"&gt;
            {% if prevEntry %}
                &lt;li class="postNav__item  postNav__item--prev"&gt;
                    &lt;a class="postNav__link  postNav__link--prev" href="{{ prevEntry.url }}"&gt;

                        {% if prevLabel != false %}
                            &lt;span class="postNav__label"&gt;{{ prevLabel }}&lt;/span&gt;
                        {% endif %}

                        &lt;span class="postNav__title"&gt;{{ prevEntry.title }}&lt;/span&gt;
                    &lt;/a&gt;
                &lt;/li&gt;
            {% endif %}

            {% if nextEntry %}
                &lt;li class="postNav__item  postNav__item--next"&gt;
                    &lt;a class="postNav__link  postNav__link--next" href="{{ nextEntry.url }}"&gt;
                        {% if nextLabel != false %}
                            &lt;span class="postNav__label"&gt;{{ nextLabel }}&lt;/span&gt;
                        {% endif %}

                        &lt;span class="postNav__title"&gt;{{ nextEntry.title }}&lt;/span&gt;
                    &lt;/a&gt;
                &lt;/li&gt;
            {% endif %}
        &lt;/ul&gt;
    {% endif %}

{% endmacro %}
</code></pre>

CC BY-SA 3.0
2016-04-23T20:17:53.723Z
Can you add the code itself for the macro? That's pretty essential to being able to assist
Patrick Harrington
<previous-next>
Prev / Next Link Problem
# Prev / Next Link Problem

(Asked by: username_0 on 2016-04-23)

I've this macro:
{{ dh_macros.dh_postNav(entry, 'blog', 'postDate', 'prev article', 'next article') }}

I call it on my blog/_single template and it works for 90% of the posts. But the newest 6 posts doesn't show the next / prev links.

This is the last post how it works fine. In the next newer post it looks like this:

Here is the next post link missing. And one post newer there is no link shown neither next nor prev :/
To appreciation, there are next / prev posts there.
It feels really random and I've no idea what's going wrong. 
Maybe someone has an idea. 
Thanks!
Here the Full Code maybe someone need it:
{#
    Prev / Next Link
    Examples:

    {{ dh_macros.dh_postNav(entry, 'work', 'postDate', 'prev work', 'next work' ) }}
#}

    {% macro dh_postNav(entry, section, order, prevLabel, nextLabel ) %}

    {# Set vars #}
    {% set section     = section|default('blog') %}
    {% set order       = order|default('postDate') %}
    {% set prevLabel   = prevLabel|default(false) %}
    {% set nextLabel   = nextLabel|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 %}

        
            {% if prevEntry %}
                
                    

                        {% if prevLabel != false %}
                            {{ prevLabel }}
                        {% endif %}

                        {{ prevEntry.title }}
                    
                
            {% endif %}

            {% if nextEntry %}
                
                    
                        {% if nextLabel != false %}
                            {{ nextLabel }}
                        {% endif %}

                        {{ nextEntry.title }}
                    
                
            {% endif %}
        
    {% endif %}

{% endmacro %}

**Tags:** previous-next
> **Comments:**
> **username_1**: Can you add the code itself for the macro? That's pretty essential to being able to assist  

---

## 1 answers

### Answer by username_1 on 2016-04-23. Score: 2 | Accepted answer

Make sure you are using
.limit(null)

In your element criteria model


---

