diff --git a/gatsby-node.js b/gatsby-node.js index 79528c1d..68e9679a 100644 --- a/gatsby-node.js +++ b/gatsby-node.js @@ -63,7 +63,7 @@ exports.createResolvers = ({ createResolvers }) => { exports.createPages = async ({ graphql, actions: { createPage } }) => { const pages = await graphql(` { - allProducts: allMoltinProduct { + allProducts: allMoltinProduct(filter: {parent: {id: {eq: null}}}) { edges { node { id diff --git a/src/templates/CategoryPage.js b/src/templates/CategoryPage.js index 814bca16..0ef2348e 100644 --- a/src/templates/CategoryPage.js +++ b/src/templates/CategoryPage.js @@ -46,7 +46,10 @@ export const query = graphql` } products: allMoltinProduct( - filter: { categories: { elemMatch: { id: { eq: $id } } } } + filter: { + categories: { elemMatch: { id: { eq: $id } } }, + parent: {id: {eq: null}} + } limit: $limit skip: $skip ) { diff --git a/src/templates/CollectionPage.js b/src/templates/CollectionPage.js index c23c4d7c..cb84f846 100644 --- a/src/templates/CollectionPage.js +++ b/src/templates/CollectionPage.js @@ -46,7 +46,11 @@ export const query = graphql` } products: allMoltinProduct( - filter: { collections: { elemMatch: { id: { eq: $id } } } } + filter: { + collections: { + elemMatch: { id: { eq: $id } } }, + parent: {id: {eq: null}} + } limit: $limit skip: $skip ) { diff --git a/src/templates/ProductsList.js b/src/templates/ProductsList.js index ac76c507..947a04c9 100644 --- a/src/templates/ProductsList.js +++ b/src/templates/ProductsList.js @@ -36,7 +36,7 @@ export default ProductsList export const query = graphql` query allProductsQuery($limit: Int!, $skip: Int!) { - allMoltinProduct(limit: $limit, skip: $skip) { + allMoltinProduct(limit: $limit, skip: $skip, filter: {parent: {id: {eq: null}}}) { edges { node { id