Hello i have following problem. I have a post single page where i want to show other related articles from the same category, except the one article on which the user currently is on, in a sidebar. So filtering out the current article isn´t a problem but filtering the posts for the category of the current post is where i got stuck.
what i tried so far was
const contents = await this.client.getEntries<IBlogPostFields>({
content_type: ContentTypes.BlogPost,
locale,
include: 1,
limit,
skip,
"fields.slug[nin]": filters?.currentPost?.fields?.slug,
fields: {
category: [
{
fields: {
slug: filters?.currentPost?.fields?.category?.[0]?.fields?.slug,
},
},
],
},
order: "sys.createdAt",
});
and this.
const contents = await this.client.getEntries<IBlogPostFields>({
content_type: ContentTypes.BlogPost,
locale,
include: 1,
limit,
skip,
"fields.slug[nin]": filters?.currentPost?.fields?.slug,
"fields.category[0].fields.slug": filters?.currentPost?.fields?.category?.[0]?.fields?.slug,
order: "sys.createdAt",
});