From 310cfe25403e3e2c8f28b93fd78588ec7f5346b3 Mon Sep 17 00:00:00 2001 From: Jerel Miller Date: Sun, 28 Nov 2021 01:10:35 -0800 Subject: [PATCH] fix: Update embed plugin to use slug instead of frontmatter path --- plugins/gatsby-plugin-embed-pages/gatsby-node.js | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/plugins/gatsby-plugin-embed-pages/gatsby-node.js b/plugins/gatsby-plugin-embed-pages/gatsby-node.js index 8bb1eea9e..7aaa1f369 100644 --- a/plugins/gatsby-plugin-embed-pages/gatsby-node.js +++ b/plugins/gatsby-plugin-embed-pages/gatsby-node.js @@ -13,7 +13,6 @@ exports.createPages = async ({ actions, graphql, reporter }) => { } frontmatter { title - path redirects } } @@ -23,13 +22,10 @@ exports.createPages = async ({ actions, graphql, reporter }) => { data.allMdx.nodes.forEach((node) => { const { - frontmatter, + frontmatter: { redirects }, fields: { fileRelativePath, slug }, } = node; - const { redirects } = frontmatter; - const nodePath = frontmatter.path || slug; - const pagePath = path.join(nodePath, 'embed', '/'); - const contentSourcePath = nodePath; + const pagePath = path.join(slug, 'embed', '/'); createPage({ path: pagePath, @@ -37,7 +33,7 @@ exports.createPages = async ({ actions, graphql, reporter }) => { context: { slug, fileRelativePath, - contentSourcePath, + contentSourcePath: slug, layout: 'EmbedLayout', }, });