Skip to content

Commit

Permalink
Merge pull request #14 from AndreaDiotallevi/staging
Browse files Browse the repository at this point in the history
fix: filter out products without slug
  • Loading branch information
AndreaDiotallevi authored Aug 20, 2024
2 parents a9da1a9 + 9f32d75 commit 0d5f3af
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions gatsby/gatsby-node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,13 +120,15 @@ export const createPages: GatsbyNode["createPages"] = async ({
})
})

res.data.allStripeProduct.edges.forEach(edge => {
createPage({
component: priceTemplate,
path: `/shop/${edge.node.metadata.category}/${edge.node.metadata.slug}`,
context: {
slug: edge.node.metadata.slug,
},
res.data.allStripeProduct.edges
.filter(edge => edge.node.metadata.slug)
.forEach(edge => {
createPage({
component: priceTemplate,
path: `/shop/${edge.node.metadata.category}/${edge.node.metadata.slug}`,
context: {
slug: edge.node.metadata.slug,
},
})
})
})
}

0 comments on commit 0d5f3af

Please sign in to comment.