Revalidate page with localization enabled #10808
Unanswered
schlesingermatthias
asked this question in
Q&A
Replies: 1 comment
-
I wrote a helper function which gets me the localized path with the locale and default slug as parameters, solving the issue of having localized slugs (impressum/imprint) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
In your localization template example you revalidate pages like that
however this does not work for localized pages as the path to revalidatePath must be an exact one for revalidation to work and the path is not just the
doc.slug
but<locale>/${doc.slug}
.As far as I understand using
revalidatePath([locale]/${doc.slug}, "page")
does not work, bc the slug being localized as well, nextjs will not find the folder in the filesystem (ie. folder might be calledimprint
but slug points to the German wordImpressum
)What I came up with is looping through all locales and revalidating every path
but I'm wondering if there's a cleaner option? thanks in advance
Beta Was this translation helpful? Give feedback.
All reactions