Skip to content

Commit

Permalink
fix: Update embed plugin to use slug instead of frontmatter path
Browse files Browse the repository at this point in the history
  • Loading branch information
jerelmiller committed Nov 28, 2021
1 parent e28311e commit 310cfe2
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions plugins/gatsby-plugin-embed-pages/gatsby-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ exports.createPages = async ({ actions, graphql, reporter }) => {
}
frontmatter {
title
path
redirects
}
}
Expand All @@ -23,21 +22,18 @@ 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,
component: path.resolve(`src/templates/embedPage.js`),
context: {
slug,
fileRelativePath,
contentSourcePath,
contentSourcePath: slug,
layout: 'EmbedLayout',
},
});
Expand Down

0 comments on commit 310cfe2

Please sign in to comment.