Delivery API: add content type to resolved links

When using the resolve_links option with the delivery API, it would be useful to get the content type (component) of the resolved story so we can create a link from it.

Use case:
Storyblok contains content. This content is being used on a website and maybe also on a mobile app through the delivery API. Inside the content, a link may appear as part of a multilink field or inside a rich text editor. We use the “internal link” link type to link to internally link to other content types.

The problem:
The website gets the story object that is being linked using the resolve_link option, but it does not provide enough information to create a link.

It is very common to base the pathname of a webpage on the content type. For example, we may have a content type “product” for which we would create the path “/products/[slug]”. The same is true for mobile apps, where you would need to navigate to the product detail screen if the linked story has the type “product”.
Right now we cannot see what the type of the story is that is being linked, so we would need to do an additional query to get the story. This can result in a lot of extra queries when dealing with rich text fields that contain a lot of stories or when creating a navigation menu based on multilink fields in Storyblok.

Proposed solution:
Add the field “content_type” or “component” to the story object or the link object.

I adopted the feature request to the information we exchanged in pm. Here is the link to it like promised:

1 Like