Skip to content

Commit

Permalink
fix: Create pages based on the slug
Browse files Browse the repository at this point in the history
  • Loading branch information
jerelmiller committed Nov 28, 2021
1 parent d214e8d commit 85c4d05
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions gatsby-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
});
Expand All @@ -114,17 +114,15 @@ 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,
fileRelativePath,
guidesFilter: ['OverviewTemplate', 'LabOverviewTemplate'].includes(
frontmatter.template
)
? `${frontmatter.path}/*`
? `${slug}/*`
: undefined,
},
});
Expand Down

0 comments on commit 85c4d05

Please sign in to comment.