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
Fixes #181
  • Loading branch information
theRuslan authored Feb 22, 2024
1 parent cce9d4d commit e245aba
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 e245aba

Please sign in to comment.