How to always display main locale in url and show locales' urls without region


I'm fairly new to prismic, and I can't wrap my head around how to change the multi-language URL management while using slice-machine.

What I want to achieve is to have the main language always displayed in the URL (for instance my main locale is Italian) so I'd like the home page to be

As you can see though, I'd like to also display all languages "region-free", so instead of /it-it and /en-gb I'd like them to be /it and /en respectively.

I looked everywhere on the docs and guide but I haven't found a clear explanation and can help me.

Thank you VERY much.

Hi @mb1 ,

Thank you for reaching out to us.

Please find the details inline:

  1. Prismic only accepts the lang, which is defined in repo settings like: "en-gb", "en-us", "fr-fr", and you want to skip regions from URL. so it will have the same treatment on "gb" and "us".
  2. On the front-end, URL lang values are handled by the developer, so let's say you have a URL like "/en/page1" or "/fr/page2", you can apply and if check in your code to verify and map the values before triggering the query on prismic.

like if you have language from URL in a variable like lang

} else if(lang=="fr"){

and so on...

  1. Then, you need to change your linkResolver function accordingly, like:
if (doc.type == "home_page" && doc.lang==“es-es”) {
   return "/es"; 

This way you can ensure to pass the correct value to Prismic while having no region value in the URL.

Let me know if you have any questions about this.


Dear Priyanka,

thank you so much for your kind answer!

It works exactly as intended. So I guess on a new project I only need to create custom languages without the region go on from that (as I've seen it's not possible to edit locales once created).

Only one thing eludes me: let's say I wanted to redirect a certain route to another one: in laravel I'd work with a middleware or I'd simply "catch" that route from my route file (i.e. /routes/web.php) and redirect it.

If I'm not mistaken there's not a route file such as the linkResolver, so how would you do it? and in what file?

I'm extremely grateful for your patience and help.



Hello @mb1,
You can create a language without a region using the custom locale feature in Prismic.

You have added a file or function in the Prismic config file for adding or modifying routes redirection rules. Find detail in this article.


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