<p>You have your <code>{% for %}</code> and <code>{% paginate %}</code> tags in the reverse order. You need to wrap the loop <em>and</em> the pagination URLs with the <code>{% paginate %}</code> tag pair:</p>

<pre><code>{% paginate craft.entries.section('houseRules').limit(1) as entries %}

    {% for entry in entries %}
        &lt;div class="rule-content"&gt;
            &lt;article&gt;
                {# Content is here #}
            &lt;/article&gt;
        &lt;/div&gt;
    {% endfor %}

    {% if paginate.prevUrl %}&lt;a href="{{ paginate.prevUrl }}"&gt;Previous Page&lt;/a&gt;{% endif %}
    {% if paginate.nextUrl %}&lt;a href="{{ paginate.nextUrl }}"&gt;Next Page&lt;/a&gt;{% endif %}

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

<p>Notice how we’re actually looping through <code>entries</code>, rather than a new <code>craft.entries</code> call. That <code>entries</code> variable will be an array of the current page’s entries. All we had to do is define what we wanted that variable to be called (e.g. “entries”).</p>

<p>See <a href="http://buildwithcraft.com/docs/templating/tags#paginate" rel="nofollow">http://buildwithcraft.com/docs/templating/tags#paginate</a> for more details on what can be done inside the <code>{% paginate %}</code> tag pair.</p>

CC BY-SA 3.0
2014-07-15T18:28:33.137Z
Great, thank you. That was tripping me up somewhat. I think it's because I'm still using an ExpressionEngine mentality when approaching pagination.
Christopher Kennedy-Nuñez
CC BY-SA 3.0
2014-07-15T18:22:38.163Z
2014-07-15T18:22:38.163Z
Brandon Kelly
<p>So I may be somewhat obtuse here, but I’m trying to discern what I might be doing wrong in this instance. I’m attempting to use a <code>{% paginate %}</code> tag inside my <code>craft.entries</code> loop to return a simple next/previous set of pagination links. I have ensured I have two entries already, so I should be seeing the pagination links, correct?</p>

<pre><code>{% for entry in craft.entries.section('houseRules').limit(1) %}
    &lt;div class="rule-content"&gt;
        &lt;article&gt;
            {# Content is Here #}
        &lt;/article&gt;
    &lt;/div&gt;
    {% paginate craft.entries as entries %}
        {% if paginate.prevUrl %}&lt;a href="{{ paginate.prevUrl }}"&gt;Previous Page&lt;/a&gt;{% endif %}
        {% if paginate.nextUrl %}&lt;a href="{{ paginate.nextUrl }}"&gt;Next Page&lt;/a&gt;{% endif %}
    {% endpaginate %}
{% endfor %}
</code></pre>

CC BY-SA 3.0
2014-07-15T18:07:52.437Z
Is this meant to be on a single-entry page? And you just want to show Previous/Next links to the neighboring entries within this “House Rules” section?
Brandon Kelly
CC BY-SA 3.0
2014-07-15T18:16:32.227Z
No, sorry. I meant to say this was the index page. I just don’t have anything but a single entry on it at the moment, so I created a dummy entry to test against a limit of (1).
Christopher Kennedy-Nuñez
CC BY-SA 3.0
2014-07-15T18:17:54.377Z
Got it, thanks. The `limit(1)` was throwing me off :)
Brandon Kelly
<pagination>
How do I create pagination links for my entry index page?
# How do I create pagination links for my entry index page?

(Asked by: username_0 on 2014-07-15)

So I may be somewhat obtuse here, but I’m trying to discern what I might be doing wrong in this instance. I’m attempting to use a {% paginate %} tag inside my craft.entries loop to return a simple next/previous set of pagination links. I have ensured I have two entries already, so I should be seeing the pagination links, correct?
{% for entry in craft.entries.section('houseRules').limit(1) %}
    
        
            {# Content is Here #}
        
    
    {% paginate craft.entries as entries %}
        {% if paginate.prevUrl %}Previous Page{% endif %}
        {% if paginate.nextUrl %}Next Page{% endif %}
    {% endpaginate %}
{% endfor %}

**Tags:** pagination

> **Comments:**
> **username_1**: Is this meant to be on a single-entry page? And you just want to show Previous/Next links to the neighboring entries within this “House Rules” section?  
> **username_0**: No, sorry. I meant to say this was the index page. I just don’t have anything but a single entry on it at the moment, so I created a dummy entry to test against a limit of (1).  
> **username_1**: Got it, thanks. The `limit(1)` was throwing me off :)  

---

## 1 answers

### Answer by username_1 on 2014-07-15. Score: 5 | Accepted answer

You have your {% for %} and {% paginate %} tags in the reverse order. You need to wrap the loop and the pagination URLs with the {% paginate %} tag pair:
{% paginate craft.entries.section('houseRules').limit(1) as entries %}

    {% for entry in entries %}
        
            
                {# Content is here #}
            
        
    {% endfor %}

    {% if paginate.prevUrl %}Previous Page{% endif %}
    {% if paginate.nextUrl %}Next Page{% endif %}

{% endpaginate %}

Notice how we’re actually looping through entries, rather than a new craft.entries call. That entries variable will be an array of the current page’s entries. All we had to do is define what we wanted that variable to be called (e.g. “entries”).
See http://buildwithcraft.com/docs/templating/tags#paginate for more details on what can be done inside the {% paginate %} tag pair.

> **Comments:**
> **username_0**: Great, thank you. That was tripping me up somewhat. I think it's because I'm still using an ExpressionEngine mentality when approaching pagination.  

---

