System Information
- Strapi Version:
- Operating System:
- Database:
- Node Version:
- NPM Version:
- Yarn Version:
I recently started working with strapi and have been figuring out how to go about content relations and so on… Now I have reached a point when I have multiple content relations dependent on each other.
This is my strucute:
Collection Types:
- Categories
- Articles
- with content relation: Article has one category
Single Types:
- Homepage
- with content relation: Homepage has many articles
Now what I want to do is to to get all nested properties of a category for articles that are assigned to homepage just by simply making a GET
request from /homepage
What I currently get is a json structure like this:
{
"id": 1,
"hero": {
....
},
"featuredArticles": {
....
},
"displayedArticles": [
{
"id": 2,
"category": 5,
}
]
}
Expected output:
{
"id": 1,
"hero": {
....
},
"featuredArticles": {
....
},
"displayedArticles": [
{
"id": 2,
"category": [
{
"id": 5,
"title": "Foundation"
}
],
}
]
}
My suspicion is that the properties of categories is basically too nested when trying to fetching from /homepage
rather than /articles
directly.
I found out that handling this could work with modifying the controllers right in the strapi directory but I haven’t figured it out quite.
Anyone willing to help please ?