<p>The above doesn't display any paging even when there is paging. It needs to be pageInfo not paginate:</p>

<pre><code>{% if pageInfo.totalPages &gt; 1 %}

    {# output current pages and pagination navigation here #}

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

CC BY-SA 3.0
2016-02-23T15:36:29.420Z
Nicole: The [craft docs](https://craftcms.com/docs/templating/paginate) use ``pageInfo`` in the example but if you don't specify, [``paginate``](https://craftcms.com/docs/templating/paginate#the-pageInfo-variable) is used by default.
RitterKnight
CC BY-SA 3.0
2016-02-23T06:37:49.147Z
2016-02-23T06:37:49.147Z
Nicole Lambon
<p>The <code>paginate.totalPages</code> variable will give you the total number of pages that are generated by the <code>paginate</code> tag. So you can wrap your display of pages around a conditional that checks to see if this is greater than 1.</p>

<pre><code>{% if paginate.totalPages &gt; 1 %}

    {# output current pages and pagination navigation here #}

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

<p>More details, including a full list of variables available, can be found in the <a href="https://craftcms.com/docs/templating/paginate">pagination docs</a>.</p>

CC BY-SA 3.0
2015-12-18T13:01:19.483Z
2015-12-18T13:01:19.483Z
Steve Rowling
<p>Below is my paginate code.
How can I check if there is more than one page? At the moment when there is only one I'm getting a '1' appear at the bottom (the page number) which looks odd. Ideally I only want it to show the pagination if the number of entries exceeds the limit, so only if it needs to display a link to the next page.</p>

<pre><code>{% paginate craft.entries.section('insights').limit(1) as entriesOnPage %}
    {% for entry in entriesOnPage %}
    &lt;article&gt;
        {% for image in entry.blogImage %}
        &lt;img src="{{ image.getUrl()}}" alt="{{ image.title }}" class="gutter-bottom--half"/&gt;
        {% endfor %}
        &lt;h3&gt;&lt;a class="descrete-link" href="{{ entry.url }}"&gt;{{ entry.title }}&lt;/a&gt;&lt;/h3&gt;
        {{ entry.body|hacksaw(chars='300', append='...') }}
        &lt;br&gt;
        &lt;br&gt;            
        &lt;p&gt;&lt;a class="button button--blue gutter-bottom--half" href="{{ entry.url }}"&gt;Continue reading&lt;/a&gt;&lt;/p&gt;
        &lt;div class="col-12-nf gutter-bottom"&gt;
            &lt;hr&gt;
        &lt;/div&gt;
    &lt;/article&gt;
    &lt;br&gt;
{% endfor %}

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

{% for page, url in paginate.getPrevUrls(5) %}
    &lt;a href="{{ url }}"&gt;{{ page }}&lt;/a&gt;
{% endfor %}

&lt;span class="current"&gt;{{ paginate.currentPage }}&lt;/span&gt;


{% for page, url in paginate.getNextUrls(5) %}
    &lt;a href="{{ url }}"&gt;{{ page }}&lt;/a&gt;
{% endfor %}

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


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

<pagination><limit>
Check if paginate
# Check if paginate

(Asked by: username_0 on 2015-12-18)

Below is my paginate code.
How can I check if there is more than one page? At the moment when there is only one I'm getting a '1' appear at the bottom (the page number) which looks odd. Ideally I only want it to show the pagination if the number of entries exceeds the limit, so only if it needs to display a link to the next page.
{% paginate craft.entries.section('insights').limit(1) as entriesOnPage %}
    {% for entry in entriesOnPage %}
    
        {% for image in entry.blogImage %}
        
        {% endfor %}
        {{ entry.title }}
        {{ entry.body|hacksaw(chars='300', append='...') }}
        
                    
        Continue reading
        
            
        
    
    
{% endfor %}

{% if paginate.prevUrl %}Previous{% endif %}

{% for page, url in paginate.getPrevUrls(5) %}
    {{ page }}
{% endfor %}

{{ paginate.currentPage }}


{% for page, url in paginate.getNextUrls(5) %}
    {{ page }}
{% endfor %}

{% if paginate.nextUrl %}Next{% endif %}


{% endpaginate %}

**Tags:** pagination, limit

---

## 2 answers

### Answer by username_3 on 2015-12-18. Score: 9 | Accepted answer

The paginate.totalPages variable will give you the total number of pages that are generated by the paginate tag. So you can wrap your display of pages around a conditional that checks to see if this is greater than 1.
{% if paginate.totalPages > 1 %}

    {# output current pages and pagination navigation here #}

{% endif %}

More details, including a full list of variables available, can be found in the pagination docs.


---

### Answer by username_1 on 2016-02-23. Score: 2

The above doesn't display any paging even when there is paging. It needs to be pageInfo not paginate:
{% if pageInfo.totalPages > 1 %}

    {# output current pages and pagination navigation here #}

{% endif %}

> **Comments:**
> **username_2**: Nicole: The [craft docs](https://craftcms.com/docs/templating/paginate) use ``pageInfo`` in the example but if you don't specify, [``paginate``](https://craftcms.com/docs/templating/paginate#the-pageInfo-variable) is used by default.  

---

