Generating blank pages

Hello,
I have disabled posts on the main page of the site.
They are not displayed.
I commented this code block:

    {{#foreach posts visibility="all"}}

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

    {{/foreach}}

Why does Ghost generate pages from my site like this?

domain.com/page/2/
domain.com/page/3/
..

Google is indexing them, but they are empty

I have 29 pages automatically created by the system, but they are empty
from /page/2 to /page/29

Any idea how to solve the problem?

I think you can increase the post_per_page amount from the package.json file.

If I increase this parameter how can I solve?
I disabled the posts from the index, but ghost continues to generate the pages as if they were there. I now have over 30 automatically generated blank pages

any info about this?

@giacomosilli the {{#foreach posts}} loop will not affect urls at all, if you comment it then it will result in blank pages because you’re telling the template not to render any of the posts that it’s given.

If you want to restrict which urls are generated or where pages appear then you’ll need to use dynamic routing.

Indeed it is obvious, I just commented on the blockade, how stupid.
Thanks, I try to understand how to use dynamic routing to solve my problem.

Hi, I had thought of solving by this way:

{{#is "paged"}}
    {{#foreach posts visibility="all"}}
    {{> "post-card"}}
    {{/foreach}}
{{/is}}

But the condition seems to have no effect, the posts are also displayed on the homepage,

even if I try with {{^is "home"}} , or with {{^is "index"}}

the goal is to show posts on the pages generated but not on the homepage

@giacomosilli have you seen this?

Yes, but the only change I wanted to make to the homepage was the one I explained, I thought the helpers worked here too.
If this is not possible I will follow this guide. Thanks

If you use helpers to hide posts on the first page of your paginated posts list then those posts won’t be listed anywhere. If you want a homepage that is separate to your posts list (it sounds like this is what you are trying to achieve) then you’ll need to use dynamic routing to set up a custom homepage as per that tutorial.