Contentful logo

Contentful Community

Setting up content preview, with a localized slug field

I’m trying to setup a content preview link (in the Contentful editor) for a model that is localized. The preview urls should point to different subdomains, so for each language will need separate content previews. The slug of the model is localized and in order to get the correct slug, I need to get hold of the field with a specified locale.
I can’t seem to find any information in the docs of how to retrieve a specific version with the {string variables syntax}.

Anyone that can point me in the right direction of how to get hold of localized value from a field?
{entry.fields.slug} returns the default language, in my case en-US as expected. But how do I retrieve the Swedish locale of the slug, my first guess would be something like: {entry.fields.slug[sv-SE]}, but no luck.

This is also the case when using the Gatsby Preview UI Extension. This extension looks for a slug content type in the content model, and uses that to create the URL (see how slug is defined in

Would anyone from Contentful be able to comment on this? I can’t see anything in the entry object that we could use.

Generating slugs with localization within a Gatsby configuration is a common approach.

However, to work with Content Preview/Gatsby Preview, it seems necessary to write out the complete slug together with localization for each page. e.g. I have to manually maintain a slug content type that contains entries such as:

  • en
  • en/about
  • en/about/contact
  • de
  • de/infos