Add initial project files

This commit is contained in:
Igor Martyniuk
2026-09-01 13:03:41 +03:00
parent 22e111bb44
commit 74cb5b6176
1841 changed files with 242819 additions and 30 deletions
+21
View File
@@ -0,0 +1,21 @@
import { hasLocale } from 'next-intl';
import { routing } from './routing';
/**
* Internal hrefs in page content are locale-prefixed (`/{locale}/{path}`);
* when the site serves unprefixed URLs, the prefix is stripped at render
* time so navigation does not bounce through the proxy redirect.
*/
export function toPublicHref(href: string): string {
if (routing.localePrefix !== 'never') {
return href;
}
const [, first = '', ...rest] = href.split('/');
if (!hasLocale(routing.locales, first)) {
return href;
}
return `/${rest.join('/')}`;
}