Not able to use pagination in my Ghost Theme

I have made a theme on ghost and have added a separate section for blogs and I had added pagination on it. On that page the total no. of pages, link to next and prev page is being shown and the link goes to /page/next or prev but the posts shown there are same. Please help me with it someone.
The code written for it as a reference is -
(This file name is page-insights.hbs)

{{!< default}}
{{!-- The tag above means - insert everything in this file into the {body} of the default.hbs template --}}

{{!-- Insights page Featured post Section --}}
{{!-- This Showes the latest featured post --}}
<div style="margin-top:50px"></div>
    <div class="mx-4">
        <aside class="read-more-wrap mb-5">
            <div class="inner">
                {{#get "posts" filter="featured:true" include="authors" limit="1" as |more_posts| }}
                  {{featured}}
                    {{#if more_posts}}
                        {{#foreach more_posts}}
                            {{> "featured-post-card"}}
                        {{/foreach}}
                    {{/if}}
                {{/get}}
            </div>
        </aside>
{{!-- //Featured post Section --}}
<hr>
{{!-- Insights page other posts Section --}}
        <aside class="read-more-wrap">
            <div class="inner">
                <div class="row">
                    {{#get "posts" include="authors" filter="featured:false" limit="9" as |more_posts| }}
{}
                        {{#if more_posts}}
                            {{#foreach more_posts}}
                                <div class="col-lg-4 col-md-6 offset-md-0 col-12 mt-2 mb-3">
                                    {{> "post-card"}}
                                </div>
                            {{/foreach}}
                            {{pagination}}
                        {{/if}}
                    {{/get}}
                </div>
            </div>
        </aside>
    </div>
{{!-- //Insights page other posts Section --}}

And the routes.yaml file is

routes:

collections:
  /:
    permalink: /blogs/{slug}/
    template: index
  /insights/:
    permalink: /blogs/{slug}/
    template: page-insights

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

For the pagination helper to work, you need to be using the posts (or tags, or whatever) context without a separate #get within the page template. The way you have it set up currently you’re always going to get those 9 posts, because that’s what the template says to do. Instead, you let routes.yaml set what posts are going to that template, don’t include a #get, and then the pagination helper should work. See this example:

1 Like