Change default "lang" value, for example "pt-pt" to just "pt"

Hello everyone, I am fresh on Prismic + nodejs, until now I could "handle" the multilingual setup, but I have a question:

How can we change the defaults values from language? For instance, I want the url to be. like: instead of

Here is a snippet I am currently using on app.js:

app.get("/multilingual/:lang/:uid", async (req, res) => {
  const api = await initApi(req);
  const defaults = await handleRequest(api);
  const lang = req.params.lang;
  const uid = req.params.uid;

  const collection_page = await api.getByUID("collection_page", uid, {
    fetchLinks: 'collection.title',

  if (collection_page) {
    res.render("pages/detail", {

On this example, how can we change the /:lang value on the app.get() outputted url?
I mean, I want to keep using the given lang value from Prismic on my code (pt-pt), but I want to output a simplified value on the urls. Just "pt" instead of "pt-pt".

Does it make sense?
Thank you

Hi @ositaka ,

Thank you for reaching out to us.

The technical flow of passing a URL is like this:

  1. The end-user hits the URL like: or
  2. We retrieve the values of lang and uid like you mentioned from req.params.
  3. we make the query using the params and send it to prismic using async/await, as you mentioned.

If I understood your case correctly, you want the lang parameter to be different in step 1 and step 3. For doing that, you need to handle this on the front-end only. For example, you can have a common place for creating a map and you can use this map for mapping values of your site. In your case, it will be like {"pt", "pt-pt"}, And you can use it to switch the params value from Step 2, before triggering a query in Step 3.
For example, even if your site is having a URL like:, you can switch the lang param using a map, and send the lang as pt-pt.

I hope that answers your question. Let me know if it does not.

Thank you,

1 Like

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