Unlock seamless workflows and faster delivery with our latest releases - Join the deep dive

Clarifying NextJS SSG build with localisation and resolving %2F issue

5 replies
Last updated: Feb 27, 2023
Hello everyone,I’ve a quick question regarding NextJS SSG build with localisation :
I’m creating my static paths as per my first screenshot with a path for each locale
But then during the build, the routes of SSG pages contains %2F char. Is this the normal behaviour or am I missing something
I’m currently on demand ISR for each local and it seems to work but I want to make sure that my static paths are generating correctly
Thanks in advance !
Feb 26, 2023, 7:08 PM
user N
%2F
is the escaped code for
/
- you don’t by chance have a folder named
/gallery
including the slash? Additionally, the value for
slug
should just be
gallery
and not
/gallery
Feb 26, 2023, 10:02 PM
user J
No I don’t have a folder named /gallery but I think you’re right about providing the wrong string to slug. I think that because I was providing the full path before and I changed it to path for the localisation.I’m going to try this out and keep you posted !
Feb 27, 2023, 10:42 AM
I was indeed providing a path instead of a slug ! Good catch
user J
thanks a ton 🙂
Feb 27, 2023, 10:51 AM
Is there a way to also generate the homepage “/” for all locales ? (website.com/ ; website.com/fr ; website.com/es )Even tho it’s a “index.tsx” so no getStaticPaths
Feb 27, 2023, 10:55 AM
user N
based on your terminal, they’re setup as
/en/home
,
/fr/home
etc - these come directly from your setup in sanity, you’ll need to change the slugs for index set in sanity to “/” I believe
Feb 27, 2023, 1:48 PM

Sanity– build remarkable experiences at scale

Sanity is a modern headless CMS that treats content as data to power your digital business. Free to get started, and pay-as-you-go on all plans.

Was this answer helpful?