From ffd04516cbbd40da2e36e73c21ea8f6b4e16ae18 Mon Sep 17 00:00:00 2001 From: Sean Perkins Date: Wed, 15 Nov 2023 17:05:15 -0500 Subject: [PATCH] chore: cleanUrls, rewrite to /docs/ --- .../LocaleDropdownNavbarItem/useAlternatePageUtils.ts | 8 +------- vercel.json | 3 ++- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/src/theme/NavbarItem/LocaleDropdownNavbarItem/useAlternatePageUtils.ts b/src/theme/NavbarItem/LocaleDropdownNavbarItem/useAlternatePageUtils.ts index 68c588eb4b6..338bbb8b8d3 100644 --- a/src/theme/NavbarItem/LocaleDropdownNavbarItem/useAlternatePageUtils.ts +++ b/src/theme/NavbarItem/LocaleDropdownNavbarItem/useAlternatePageUtils.ts @@ -49,20 +49,14 @@ export function useAlternatePageUtils(): { baseUrl, }); - const formattedBaseUrl = applyTrailingSlash(baseUrl, { - trailingSlash, - baseUrl, - }); - const baseUrlUnlocalized = currentLocale === defaultLocale ? baseUrl : baseUrl.replace(`/${currentLocale}/`, '/'); - const pathnameSuffix = canonicalPathname.replace(formattedBaseUrl, ''); + const pathnameSuffix = canonicalPathname.replace(baseUrl, ''); console.log('pathNameSuffix', { pathnameSuffix, canonicalPathname, baseUrl, - formattedBaseUrl, }); function getLocalizedBaseUrl(locale: string) { diff --git a/vercel.json b/vercel.json index 5314cf93c62..7e9a87defbe 100644 --- a/vercel.json +++ b/vercel.json @@ -1,5 +1,6 @@ { "trailingSlash": false, + "cleanUrls": true, "redirects": [ { "source": "/", "destination": "/docs/" }, { @@ -68,7 +69,7 @@ { "source": "/docs/react/testing", "destination": "/docs/react/testing/introduction" } ], "rewrites": [ - { "source": "/docs", "destination": "/" }, + { "source": "/docs/", "destination": "/" }, { "source": "/docs/:match*", "destination": "/:match*" } ] }