Skip to content

Instantly share code, notes, and snippets.

@danilowoz
Last active April 28, 2019 19:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danilowoz/11f78f01c2cf6a871c19ade8feb54cf7 to your computer and use it in GitHub Desktop.
Save danilowoz/11f78f01c2cf6a871c19ade8feb54cf7 to your computer and use it in GitHub Desktop.
Creating a blog post list page
Array.from({ length: numPages }).forEach((_, i) => {
createPage({
path: i === 0 ? `/blog` : `/blog/page/${i + 1}`,
component: blogListLayout,
context: {
limit: postsPerPage,
skip: i * postsPerPage,
currentPage: i + 1,
numPages,
},
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment