Skip to content

Commit 4ddf732

Browse files
fix: #2081 resolve URL with locale prefix in getWordPressProps (#2082)
* fix: #2081 resolve URL with locale prefix in getWordPressProps * docs: Add changeset for getWorpdressProps
1 parent b10ef35 commit 4ddf732

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

.changeset/angry-lands-rush.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@faustwp/core': patch
3+
---
4+
5+
Fixed an issue with the `getWordPressProps` function where the resolved URL was not correctly set for non-SSR contexts.

packages/faustwp-core/src/getWordPressProps.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,10 @@ export async function getWordPressProps(
107107
ctx.res.setHeader('x-using', 'faust');
108108
}
109109

110+
if (ctx.locale !== ctx.defaultLocale && resolvedUrl !== '/') {
111+
resolvedUrl = `/${ctx.locale}${resolvedUrl}`;
112+
}
113+
110114
resolvedUrl = hooks.applyFilters('resolvedUrl', resolvedUrl, {
111115
nextContext: ctx,
112116
}) as string | null;

0 commit comments

Comments
 (0)