How AI is powering better personalization in e-commerce [with Vercel]. Sign up now

Should slugs be translated in Sanity translation template?

3 repliesLast updated: Nov 29, 2025

has anyone used https://github.com/sanity-io/sanity-template-translation-examples ? Have you translated the slugs too? I’m curious why this has not been accounted as part of the starter, am I missing something you shouldn’t do? 👀
AI Update

You're not missing anything – you're actually asking a great question! The archived sanity-template-translation-examples repository demonstrates two main localization approaches but doesn't explicitly handle translated slugs in the examples. This is actually intentional, and here's why:

Why Slugs Often Aren't Translated

For Document-Level Translations: When using the @sanity/document-internationalization plugin, each language version is a separate document. This means each document can (and should) have its own unique slug field. The template doesn't need special handling because the slug is just another field on the document – it's naturally independent per language version.

For Field-Level Translations: When using field-level translation (objects or arrays), slugs typically aren't translated because:

If You DO Need Translated Slugs

With @sanity/document-internationalization: Just add a regular slug field to your schema – each language document gets its own slug automatically. The Sanity docs on localization show this pattern in the "post" example schema, where the slug field exists on each translated document.

With field-level translations (using internationalized-array): You can make the slug field internationalized just like any other field. However, you'll need to handle uniqueness validation yourself, as Sanity's built-in slug uniqueness validation doesn't work across internationalized arrays.

Best Practices

The Sanity documentation recommends:

The template focuses on the core localization patterns, leaving routing and URL structure decisions to your specific front-end implementation. It's not an oversight – it's acknowledging that slug translation requirements vary significantly between projects, and most implementations handle this through routing strategy rather than translated slug fields.

Show original thread
3 replies

Was this answer helpful?

Sanity – Build the way you think, not the way your CMS thinks

Sanity is the developer-first content operating system that gives you complete control. Schema-as-code, GROQ queries, and real-time APIs mean no more workarounds or waiting for deployments. Free to start, scale as you grow.

Related contributions