Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Headless CMS GraphQL NextJS Project Post Limit Issue

I have a Headless cms project I created using GraphQl, NextJS and Hygraph.
I’m also using NPM Graphql-request.
I’m having issues "receiving" more than 10 posts on my project.
So far I had less then 10 posts on my site, but now that I posted more, I’m simply not receiving the extra ones.
I did some research but I can’t seem to find the solution!

Here’s what I got:

const QUERY = gql`
  {
    posts {
      title
      id
      slug
      datePublished
      mobileCoverPhoto {
        url
      }
      coverPhoto {
        id
        url
      }
      category
      imageAtlTag
      author {
        id
        name
        avatar {
          url
        }
      }
      content {
        text
        html
      }
    }
  }
`;

Everything works fine until post #10 only.
Thanks everyone for helping!

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

10 is the default number of fetched posts. If you want to specify the number of posts you need to do it like this:

 posts(first: 10) {
   nodes {
     title
    slug
   }
  }
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading