In Gatsby starter blog, how to increase number of latest posts from 3 to 20 in home page

Viewed 191

I am starting to use Gatsby Minimal Starter Blog by LekoArts and Github repo. Currently only 3 latest posts can be displayed in the home page. Can i know how to increase it like from 3 to 30. I don't see any settings for that.

1 Answers

It's defined in the graphql query in homepage-query.tsx:

export const query = graphql`
  query($formatString: String!) {
    allPost(sort: { fields: date, order: DESC }, limit: 3) {
      nodes {
        slug
        title
        date(formatString: $formatString)
        excerpt
        timeToRead
        description
        tags {
          name
          slug
        }
      }
    }
  }
`

which is used by gatsby-node.js in gatsby-theme-minimal-blog-core (a dependency).

const homepageTemplate = require.resolve(`./src/templates/homepage-query.tsx`)
Related