Forum

Thread tagged as: Question

prev_url not working with rewrite

Hi guys,

So it looks for some reason that the prev_url in blog is not working with the rewrite tag?
The next_url seems to work fine.

Here is part of my template

    <perch:if exists="paging">
        <div class="pagination">
            <perch:blog id="page_links" encode="false" />
            <p class="pagination__link // pagination__page">Page <perch:blog id="current_page" type="hidden" /> of <perch:blog id="number_of_pages" type="hidden" /></p>

            <perch:if exists="not_first_page">
                <a href="<perch:blog id="prev_url" encode="false" rewrite="/news/{page:%s}" />" class="pagination__link pagination__link--prev" rel="prev">Prev</a>
            </perch:if>

            <perch:if exists="not_last_page">
                <a href="<perch:blog id="next_url" encode="false" rewrite="/news/{page:%s}" />" class="pagination__link pagination__link--next" rel="next">Next</a>
            </perch:if>
        </div>
    </perch:if>

So the urls that appear are as follows;

Next - /news/3/ (where 3 is the page number)

But the Prev link only outputs as /new/ regardless of what page you are on.

Any ideas? or a bug to be fixed?

Thanks, Terry

Terry Upton

Terry Upton 0 points

  • 5 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

Does it work without the rewrite attribute?

Yes if I remove the rewrite attribute it works. Thanks Drew.