Contentful logo

Contentful Community

Content preview URLs - get field value of linked model

Hello.

I’m trying to configure preview in my online environment.
I have Page content model with slug field and Resource content model with pageGroup field (accepts only the Page model).
The issue is to set preview for the resource model as //host/entry.pageGroup.slug/entry.id
When I’m getting the id of the pageGroup in the way
//host/{entry.fields.pageGroup.sys.id} - it works right.
When I’m trying to get the slug field of the Page group in the way
//host/{entry.fields.pageGroup.fields.slug} - there is an error
//host/fields.pageGroup.fields.slug_%20NOT_FOUND
‘entry’ in these examples is the Resource model.
Is there any possibility to have a slug value of the page model from the resource?

If it’s not very clear, feel free to ask me more questions, I will try to explain the issue in more details.

Hi Andrii, I am Alma from Contentful support :wave:

There are some limitations in the default content preview function, and you just observed one: it doesn’t resolve content of linked entries :sweat_smile:

As a workaround, you might want to use Content Preview API to build you own preview site. Content Preview API (https://www.contentful.com/developers/docs/references/content-preview-api/) works has a similar setup as Content Delivery API, so you can leverage on your existing application to create the preview site.