<p>The example is the docs you're referring to will simple output the first "page" of the Rich Text field and if there are more pages show a "Continue Reading" link that loads the full entry.</p>

<p>For the functionality you're looking for you'd have to do something like this (completely untested):</p>

<pre><code>{% set totalPages = entry.body.getTotalPages() %}

{% for i in 1..totalPages %}
    &lt;a href="{{ url(entry.url, {page: i}) }}"&gt;{{ i }}&lt;/a&gt;
{% endfor %}
</code></pre>

<p>Then your template would grab the <code>page</code> from the querystring and display it  using <code>entry.body.getPage(page)</code>.</p>

CC BY-SA 3.0
2016-01-12T08:29:11.920Z
Thank you! Now I got it working. Clearly the docs are missing this part.
Yuri Salimovskiy
CC BY-SA 3.0
2016-01-11T23:25:45.500Z
2016-01-11T23:25:45.500Z
Brad Bell
<p>I am trying to split entry into multiple pages.</p>

<p>In accordance with the <a href="https://craftcms.com/docs/rich-text-fields" rel="nofollow">docs</a>, I am using this code on single-entry template:</p>

<pre><code>{{ entry.body.getPage(1) }}

{% if entry.body.getTotalPages() &gt; 1 %}
  &lt;a href="{{ entry.url }}"&gt;Continue reading…&lt;/a&gt;
{% endif %}
</code></pre>

<p>However <code>{{ entry.url }}</code> is always pointing to the same page that I'm on (base entry URL) without any pagination number, so I never get to second page.
I have checked that <code>{{entry.body.getTotalPages()}}</code> returns 2, so the pagebreak plugin is working.</p>

<p>What am I missing here?</p>

<p><strong>Answer:</strong></p>

<p>Here's the working code that I got with Brad Bell's help:</p>

<pre><code>{% set currentPage = 1 %}
{% if craft.request.getParam('page') is not empty %}
    {% set currentPage = craft.request.getParam('page') %}
{% endif %}

{{ entry.body.getPage(currentPage) }}

{% if entry.body.getTotalPages() &gt; 1 %}
    {% set totalPages = entry.body.getTotalPages() %}

    {% for i in 1..totalPages %}
    &lt;a href="{{ url(entry.url, {page: i}) }}"&gt;go to page: {{ i }}&lt;/a&gt;
    {% endfor %}
{% endif %}
</code></pre>

<redactor><pagination>
Redactor pagebreak plugin and linking to pages
# Redactor pagebreak plugin and linking to pages

(Asked by: username_0 on 2016-01-11)

I am trying to split entry into multiple pages.
In accordance with the docs, I am using this code on single-entry template:
{{ entry.body.getPage(1) }}

{% if entry.body.getTotalPages() > 1 %}
  Continue reading…
{% endif %}

However {{ entry.url }} is always pointing to the same page that I'm on (base entry URL) without any pagination number, so I never get to second page.
I have checked that {{entry.body.getTotalPages()}} returns 2, so the pagebreak plugin is working.
What am I missing here?
Answer:
Here's the working code that I got with Brad Bell's help:
{% set currentPage = 1 %}
{% if craft.request.getParam('page') is not empty %}
    {% set currentPage = craft.request.getParam('page') %}
{% endif %}

{{ entry.body.getPage(currentPage) }}

{% if entry.body.getTotalPages() > 1 %}
    {% set totalPages = entry.body.getTotalPages() %}

    {% for i in 1..totalPages %}
    go to page: {{ i }}
    {% endfor %}
{% endif %}

**Tags:** redactor, pagination

---

## 1 answers

### Answer by username_1 on 2016-01-11. Score: 2 | Accepted answer

The example is the docs you're referring to will simple output the first "page" of the Rich Text field and if there are more pages show a "Continue Reading" link that loads the full entry.
For the functionality you're looking for you'd have to do something like this (completely untested):
{% set totalPages = entry.body.getTotalPages() %}

{% for i in 1..totalPages %}
    {{ i }}
{% endfor %}

Then your template would grab the page from the querystring and display it  using entry.body.getPage(page).

> **Comments:**
> **username_0**: Thank you! Now I got it working. Clearly the docs are missing this part.  

---

