Skip to content

Commit

Permalink
Redirects docs: added example and note about pathPrefix
Browse files Browse the repository at this point in the history
  • Loading branch information
theRuslan committed May 28, 2022
1 parent fbd9374 commit bd40098
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 bd40098

Please sign in to comment.