This forum has moved to a new location and is in read-only mode. Please visit to access the new location.


Hi all!

I would like to ask you for help/suggestion. Im building simple magazine with Everything is fine, just one thing. My layout has left sidebar with navigation and main window with content.

I have 'Category List' component in sidebar to have navigation part from categories which leads to category page with articles from that category. This is fine, because for example I have:

  • Cats (12) [category/cats]
  • Dogs (8) [category/dogs]

This is name, number of posts in category and generated url.

I have /category/:slug/:page? and pagination works fine. But linking doesn't. Lets say we have 4 posts per pagination page. If you are on second pagination page in Cats, then all urls in navigation sidebar are /2. When you click on them, it will take you to second paginated page of that category. Cats has three pages in this example, so on the last page, all urls has /3. When you click on Dogs in navigation, it will take you nearest one, which is /2, which is nice, at least it wont drop on 404 for now.

So my question is, if there is any way how to generate urls in 'Category List' component, to ignore pagination numbers. Just to point always to first pagination page.

Thank you very much for any advice!


I dont know if this is what you're looking for, but you can display your records list and add pagination to it. You may be able to better control the pagination this way.

Records List

{% if records.LastPage >= 1 %}
    {% for record in records %}            
        {{ }}  
    {% endfor %}
{% endif %}


{% if records.LastPage > 1 %}

    <ul class="pagination">
        {% if records.CurrentPage > 1 %}
            <li><a href="{{|page({ (pageParam): (records.CurrentPage-1) }) }}">← Prev</a></li>
        {% endif %}

        {% for page in 1..records.LastPage %}
            <li class="{{ records.CurrentPage == page ? 'active' : null }}">
                <a href="{{|page({ (pageParam): page }) }}">{{ page }}</a>
        {% endfor %}

        {% if records.LastPage > records.CurrentPage %}
            <li><a href="{{|page({ (pageParam): (records.CurrentPage+1) }) }}">Next →</a></li>
        {% endif %}

{% endif %}

Last updated


Hi mattm!

Thanks for your answer, but pagination in my case works well. And I have very similar code applied as you posted.

Thing is, when Im on second pagination page, for example, then all of my navigation links of category list has the number in url:

  • Home
  • Categories
    • Cats [/category/cats/2]
    • Dogs [/category/dogs/2]
  • Contact

And I would like to have them without the current pagination page number in navigation url. For now, Im choping it off with javascript, but I believe there is smarter way to keep the urls without pagination numbers.

But thank you


I also faced this problem and I can't solve it...

Using a crutch:

$(document).ready(function(){ $('.category-list li').each(function() { var elem = $(this).find('a'); var str = elem.attr('href'); var link = str.replace(/\/\d+/, ''); elem.attr('href', link ); }); });

Last updated


I know this is a rather old thread, but I came across this thread when I faced the same problem and searched for a solution (getting around to learn OctoberCMS these days).

So for others having the same problem: the page filter has a second parameter for using persistent URL parameters, as explained here:

So you can get the base URL of your category by using

<a href="{{ 'cats'|page(false) }}">Cats</a>


<a href="{{ 'cats'|page({ (pageParam): null) }}">Cats</a>

in your category nav.

Similarly, you can link to any specific page by passing an existing ID as value for pageParam.

Hope this helps.

1-5 of 5

You cannot edit posts or make replies: the forum has moved to