Have a simple model like post / category / subcategory with relation between posts <-> subcategories & categories <-> subcategories.
Questions are :
- How to make the GraphQL request with the
gatsby-source-contentful
plugin in order to get all post in category page (without adding a relation field between posts & categories ? - Is it the Contentful right way for having post classification in a 2 levels tree ?
Seems to be enable by Contentful API as said in this post : https://www.contentful.com/blog/2015/02/17/content-trees-tags-and-facets-in-contentful/
Thx for replies
{
contentfulCategory(id: {eq: $id}) {
id
title
post <- ?
subcategories {
slug
title
post {
id
title
}
}
}
}
Maybe a way to do that is something close to :
{
contentfulCategory(id: {eq: $id}) {
id
title
subcategories {
slug
title
}
}
allContentfulPost(filter to category ?) {
edges {
node {
slug
title
}
}
}