How to get 'title' and other fields from content relation field within a slice(Nextjs)

Hi guys,

Kinda confused on how to achieve this, I am pretty bad at explaining this so I will try to make it clear what I am trying to accomplish.

I have a basic nextjs set up based the multi language Prismic demo here

I have a post type called 'people' and a 'home page', the people post type has a 'title' and a 'photo'

On the home page I have a 'team' slice which is a repeatable content relationship field where you can add people, I have done this as a slice so its dynamic.

Currently the data returned from this only has slug, id, tags... but I would like to show the photo and title.

Is there anyway to have this information returned from the API, or do I need to query the returned IDs within the slice?

Hey @hachi.studio.

Welcome to the Prismic community forum! :slight_smile:

Not to worry, your explanation is good. If I understand everything correctly, it's just a matter of adding a fetchLinks option to your query, as described in this thread:

Are you using Slice Machine? If so, the query might look a little different, but the principle is the same.

Let me know if you have any other questions.

Sam

Sorry for the late reply @samlittlefair but that was exactly what I looking for!

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.