Skip to content

Instantly share code, notes, and snippets.

@amandeepmittal
Created November 17, 2018 09:12
Show Gist options
  • Save amandeepmittal/08269f4b0ddc8212717a4e56d9a87848 to your computer and use it in GitHub Desktop.
Save amandeepmittal/08269f4b0ddc8212717a4e56d9a87848 to your computer and use it in GitHub Desktop.
posts.forEach(({ node }, index) => {
const path = node.frontmatter.path;
createPage({
path,
component: blogPostTemplate,
context: {
pathSlug: path,
prev: index === 0 ? null : posts[index - 1].node,
next: index === posts.length - 1 ? null : posts[index + 1].node
}
});
resolve();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment