-
Hello everyone, I've gone through a migration from v2 to v5 and faced a few issues which I need help with since all my efforts have been unsuccessful. I have a section in my node which populates pages for my blog as follows: Array.from({ length: numPages }).forEach((_, i) => {
createPage({
path: `${prefix}/${i === 0 ? '' : i + 1}`,
component: path.resolve(`src/templates/blog-list.js`),
context: {
limit: postsPerPage,
skip: i * postsPerPage,
numPages,
currentPage: i + 1,
},
});
}); In my blog list template I have a const pageQuery = graphql`
query ($limit: Int!, $skip: Int!) {
allMarkdownRemark(limit: $limit, skip: $skip) {
edges {
node {
id
html
timeToRead
frontmatter {
title
unformattedDate: date
date(formatString: "MMM DD, YYYY")
path
author
tags
thumbnail {
childImageSharp {
gatsbyImageData(layout: CONSTRAINED)
}
}
}
}
}
}
}
`; When I build the site I get an error that the limit and skip are not passed to the template (located in the Full code is here: https://github.com/yashints/yashints.dev/tree/upgrade PS: while you're at it have a look at the GitHub component in the |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Found out the issue myself after digging a little bit more, I was incorrectly using static query for a page |
Beta Was this translation helpful? Give feedback.
Found out the issue myself after digging a little bit more, I was incorrectly using static query for a page