Contentful logo

Contentful Community

Query for related articles with similar tags as the currently viewed article ? (article...tagList[]

#1

Greetings… had a bit issue with formulating the questions topic good enough…
I’ll describe : …

Someone views an article (contenttype : article). This article has a list of tags (contenttype : articletags).

Based on the linked tags in this article, i am trying to do a query for article’s which has one or more of the same tags linked to it… (Call it Related Articles with same tags)

Here is the structure :
let tags = article.items[0].fields.tagsList.map(tag => {
return tag.fields.navn
})

… Which i need to query for articles like this :
contentful.getEntries({content_type: ‘article’}) ???
// how can i query for the id’s ?

Hope someone has knowledge on how to do this :slight_smile: It’s erhm… unfortunately quite urgent due to demo-time shortly…

0 Likes

#2

Hi @terje.nygard,

I’m assuming you have tags as entries that are eventually linked to your entry, is that correct?

0 Likes