Skip to content

Commit b9a8c22

Browse files
authored
Add basepath to breadcrumb (#917)
1 parent d4be568 commit b9a8c22

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

packages/pxweb2/src/app/components/ContentTop/ContentTop.tsx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -193,25 +193,29 @@ export function ContentTop({
193193
const showLangInPath =
194194
config.language.showDefaultLanguageInPath ||
195195
language !== config.language.defaultLanguage;
196-
const langPrefix = showLangInPath ? `/${language}` : '';
196+
const langPrefix = showLangInPath ? `${language}` : '';
197+
const basePath = config.baseApplicationPath || '';
197198

198199
breadcrumbItems.push({
199200
label: t('common.breadcrumbs.breadcrumb_root_title'),
200-
href: langPrefix,
201+
href: basePath + langPrefix,
201202
});
202203

203204
if (pathElements && pathElements.length > 0) {
204205
breadcrumbItems.push(
205206
...pathWithUniqueIds.map((path) => ({
206207
label: path.label,
207-
href: `${langPrefix}?subject=${path.uniqueId}`,
208+
href: `${basePath}${langPrefix}?subject=${path.uniqueId}`,
208209
})),
209210
);
210211
}
211212

212213
breadcrumbItems.push({
213214
label: staticTitle,
214-
href: location.pathname + location.search + location.hash,
215+
href:
216+
basePath + location.pathname.startsWith('/')
217+
? location.pathname.substring(1)
218+
: location.pathname + location.search + location.hash,
215219
});
216220

217221
return breadcrumbItems;

0 commit comments

Comments
 (0)