From 85c4d05536bc68d4775941f8d5949207c76fc201 Mon Sep 17 00:00:00 2001 From: Jerel Miller Date: Sun, 28 Nov 2021 00:28:24 -0800 Subject: [PATCH] fix: Create pages based on the slug --- gatsby-node.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/gatsby-node.js b/gatsby-node.js index 815cf7cf4..d9216b65b 100644 --- a/gatsby-node.js +++ b/gatsby-node.js @@ -89,7 +89,7 @@ exports.createPages = async ({ actions, graphql, reporter }) => { frontmatter.redirects.forEach((fromPath) => { createRedirect({ fromPath, - toPath: frontmatter.path, + toPath: slug, isPermanent: true, redirectInBrowser: true, }); @@ -114,9 +114,7 @@ File path does not match frontmatter path: } createPage({ - path: frontmatter.path - ? path.join(frontmatter.path, '/') - : path.join(slug, '/'), + path: path.join(slug, '/'), component: path.resolve(`src/templates/${frontmatter.template}.js`), context: { slug, @@ -124,7 +122,7 @@ File path does not match frontmatter path: guidesFilter: ['OverviewTemplate', 'LabOverviewTemplate'].includes( frontmatter.template ) - ? `${frontmatter.path}/*` + ? `${slug}/*` : undefined, }, });