From e245ababa7cdef4d74083969658460ea2add307a Mon Sep 17 00:00:00 2001 From: Ruslan Zainetdinov Date: Thu, 22 Feb 2024 12:51:55 +0300 Subject: [PATCH] docs(next-drupal): add example and note about pathPrefix Fixes #181 --- www/content/guides/redirects.mdx | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/www/content/guides/redirects.mdx b/www/content/guides/redirects.mdx index 52ea8e83..a0c6d38e 100644 --- a/www/content/guides/redirects.mdx +++ b/www/content/guides/redirects.mdx @@ -72,3 +72,13 @@ export async function getStaticProps( ``` With `fallback: "blocking"` in `getStaticPaths`, this will cache and handle redirects configured in Drupal and still work with incremental static regeneration. + +In multilingual setup you may need to specify `pathPrefix` option for `translatePathFromContext` for default locale. +In some cases Drupal can't find a matching redirect for path without explicit locale prefix. + +```tsx +// Get information about the path. +const path = await drupal.translatePathFromContext(context, { + pathPrefix: context.locale === context.defaultLocale ? context.locale : "/", +}) +```