Contentful logo

Contentful Community

Is it possible to include image asset URLs but exclude linked entries?

I have two content-types - ProjectSummary, and ProjectDetails.

ProjectSummary is light data with a title, a short summary, and an image, from which I’m rendering an index page. ProjectDetails is a heavy page with a lot of rich text. Each ProjectSummary item has a Link to a ProjectDetails item.

I’d like to pull all ProjectSummary items when the user loads the index page, but to set the ‘include’ parameter to zero so that I’m not getting all the ProjectDetails content at the same time.

The problem is that when I set ‘include:0’, I’m losing the URLs to the ProjectSummary image assets as well.

Is there a way I can cause the API to include image asset details, but not the content of linked Entries?

(I’m using the JavaScript SDK)

Hi @jon1,

The issue here is that the include implementation resolves both entries and assets that are linked to a given parent entry, and there is not a way to set a distinction between the fetching process associated with each of them.

Because of that, you’d have to either parse the response in your side and clear the content from linked entries or manually request each asset through their ID, which would be more cumbersome.

Hi Gabriel,

Thanks, and understood. Have gone a slightly different way after reviewing the docs and all is good.

(I’ve switched to a single ‘Project’ content-type and used the ‘select’ parameter to pull only the summary-related fields for the index page, with the details pages pulling the full records as needed).