Created
April 27, 2020 07:28
Revisions
-
rubenRP created this gist
Apr 27, 2020 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,29 @@ posts.forEach((post, index) => { const previous = index === posts.length - 1 ? null : posts[index + 1].node const next = index === 0 ? null : posts[index - 1].node const path = post.node.fileAbsolutePath const regex = "/blog/" if (path.match(regex)) { createPage({ path: `blog${post.node.fields.slug}`, component: blogPost, context: { slug: post.node.fields.slug, previous, next, }, }) } else { createPage({ path: `${post.node.fields.slug}`, component: defaultPage, context: { slug: post.node.fields.slug, }, }) } // return null }) ...