Skip to content

Commit

Permalink
docs(next-drupal): add example and note about pathPrefix
Browse files Browse the repository at this point in the history
  • Loading branch information
theRuslan authored and marcorcau committed Mar 26, 2024
1 parent 6395122 commit 6fdc0be
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions www/content/guides/redirects.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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 : "/",
})
```

0 comments on commit 6fdc0be

Please sign in to comment.