Hi there,
I am struggling to find a way to filter tags by category.
I have a category content model that consists of a slug and a title, both are short text fields. This content model is added to my blog posts as a reference object referencing many categories ( if that makes sense ).
On a single blog post page, I want to load more posts that have similar categories, but exclude the current post from the results.
The problem from what I read is, “Filtering by a linked collection entry is not supported right now”.
So I cannot create a graphQL query like this:
{
articleCollection(
where: {
slug_not: "exclude-this-slug"
categoriesCollection: {
slug: "category"
}
}
) {
items {
title
}
}
}
I can get the articles doing a query like this:
{
categoriesCollection (
where: {
slug: "category"
}
) {
items {
linkedFrom {
articleCollection {
items {
title
}
}
}
}
}
}
But there seems to be no way to filter out the current post as the only filters I can add to the articleCollection within that query seems to be skip, limit, locale and preview.
Is there any way I can get related posts by using the category as a content model, as I am currently doing or is there perhaps a different solution to this?
Thanks in advance