fix: detect language prefix in relative hrefs without leading slash

This commit is contained in:
alam00000
2026-01-26 23:14:05 +05:30
parent c2520f7736
commit c010327daa

View File

@@ -209,7 +209,7 @@ export const rewriteLinks = (): void => {
} }
const langPrefixRegex = new RegExp( const langPrefixRegex = new RegExp(
`^(${basePath.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')})?/(en|fr|es|de|zh|zh-TW|vi|tr|id|it|pt|nl)(/|$)` `^(${basePath.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')})?/?(en|fr|es|de|zh|zh-TW|vi|tr|id|it|pt|nl)(/|$)`
); );
if (langPrefixRegex.test(href)) { if (langPrefixRegex.test(href)) {
return; return;