Pagination log show different setting than configured limit

I have issue that my Ghost theme is not showing the pagination code.

This is pretty default code:

<div class="inner posts">
    <div class="post-feed">
        {{#foreach posts limit="12"}}
            {{!-- The tag below includes the markup for each post - partials/post-card.hbs --}}
            {{> "post-card"}}
    {{log pagination}}

As you can see I set up limit at 12, my package.json has no posts_per_page configuration.

This is what {{log pagination}} shows.

{ page: 1, limit: 5, pages: 3, total: 14, next: 2, prev: null }

Whatever I do, I cant get more posts on page than 5. If I use limit=“12” it gets ignored. The only change I can see is if I change limit to lower than 5. Even if I do that, I never get pagination, I cant see number of pages, I dont have Next, nothing.

I am using routes.yaml with the following setup:

    controller: channel
    template: tag
    data: tag.udalosti
    filter: primary_tag:udalosti

    permalink: /{slug}/
    template: index

  tag: /tag/{slug}/
  author: /author/{slug}/

The limit attribute on the foreach helper doesn’t change the number of posts per page. It’ll only limit the number of posts iterated looped through in the foreach.

Instead, I think you’ll want to set the posts_per_page value to ‘12’ in package.json. The 5 you’re seeing is the default, what Ghost falls back to when the value isn’t set.

Let me know if that makes sense.

I put posts_per_page value to ‘12’ in package.json

I simplified code, also deleted infinite-scroll.js, so I dont get auto pagination.

This is what happens, if code is this simple:|

        {{#foreach posts }}
            {{!-- The tag below includes the markup for each post - partials/post-card.hbs --}}
            {{> "post-card"}}


    {{log pagination}}
    Total: {{ }} 
    Pages: {{pagination.pages }} 

I get following results from log: { page: 1, limit: 12, pages: 2, total: 14, next: 2, prev: null }. So I get correct page size (12) as setup in package.json.

So the log is correct, even {{ }}, {{pagination.pages }} show correct counts.

Still `{{pagination}}’ is not generating any code for pager.

Sometimes difficult problems have easiest solutions. I removed class “pagination” and it shows. Meaning that this is rather CSS issue with the casper theme (or my fork). I will try this on default casper theme and will be back to close this. Thanks!

Yep, it’s the CSS for default Casper. Because Casper uses infinite scroll by default, it hides the pagination element. Changing this CSS or creating a custom pagination element will show the pagination element.