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 !
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
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 !
I was indeed providing a path instead of a slug ! Good catch
user J
thanks a ton 🙂
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
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

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.

Was this answer helpful?