From 13754e445a748243302e802717b0bfab2013f975 Mon Sep 17 00:00:00 2001 From: Pratham Kamthan Date: Thu, 15 Jan 2026 07:33:01 +0530 Subject: [PATCH 1/3] feat: add redirect for localized docs URLs to non-localized version Signed-off-by: Pratham Kamthan --- src/middleware.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/middleware.ts b/src/middleware.ts index 93fec121..1ba614cf 100644 --- a/src/middleware.ts +++ b/src/middleware.ts @@ -15,6 +15,16 @@ export default function middleware(request: NextRequest) { return NextResponse.redirect("https://kubestellar.io/docs", 301); } + // Redirect localized docs URLs to non-localized version + // e.g., /es/docs/... -> /docs/... + const docsPathMatch = request.nextUrl.pathname.match(/^\/([a-z]{2}(?:-[A-Z]{2})?|SC)\/docs\//); + if (docsPathMatch) { + const url = request.nextUrl.clone(); + // Remove the locale prefix from the pathname + url.pathname = url.pathname.replace(/^\/[a-z]{2}(?:-[A-Z]{2})?\/docs\//, '/docs/').replace(/^\/SC\/docs\//, '/docs/'); + return NextResponse.redirect(url, 307); + } + // Explicitly handle root path to ensure consistent redirect to /en // This helps override any cached redirects in browsers like Safari if (request.nextUrl.pathname === "/") { @@ -29,7 +39,7 @@ export default function middleware(request: NextRequest) { export const config = { matcher: [ - "/((?!docs|api|_next|_vercel|agenda|blog|code|community|drive|infomercial|join_us|joinus|ladder|ladder_stats|linkedin|quickstart|slack|survey|tv|youtube|.*\\..*).*)", + "/((?!docs|api|_next|_vercel|agenda|blog|code|community|drive|infomercial|join_us|joinus|ladder_stats|linkedin|quickstart|slack|survey|tv|youtube|.*\\..*).*)", "/", ], }; From b9c5a607b63c6b3c58abb406e38110f0afc0b2f7 Mon Sep 17 00:00:00 2001 From: Pratham Kamthan Date: Thu, 15 Jan 2026 13:00:39 +0530 Subject: [PATCH 2/3] fix: replace standard Link with LocalizedLink for improved internationalization support in Navbar Signed-off-by: Pratham Kamthan --- src/components/Navbar.tsx | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/src/components/Navbar.tsx b/src/components/Navbar.tsx index cc4dcf46..15a2fc21 100644 --- a/src/components/Navbar.tsx +++ b/src/components/Navbar.tsx @@ -1,6 +1,7 @@ "use client"; import React, { useState, useEffect, useRef } from "react"; +import { Link as LocalizedLink } from "@/i18n/navigation"; import Link from "next/link"; import Image from "next/image"; import { GridLines, StarField, LanguageSwitcher } from "./index"; @@ -615,7 +616,7 @@ export default function Navbar() { {t("products")} - @@ -633,7 +634,7 @@ export default function Navbar() { > {t("ladder")} - + {t("programs")} - @@ -758,8 +759,8 @@ export default function Navbar() { > {t("contactUs")} - - + @@ -777,7 +778,7 @@ export default function Navbar() { > {t("partners")} - + @@ -1139,7 +1140,7 @@ export default function Navbar() {
- @@ -1159,7 +1160,7 @@ export default function Navbar() {
{t("ladder")} - +
- @@ -1257,10 +1258,10 @@ export default function Navbar() {
{t("contactUs")} - +
- @@ -1280,7 +1281,7 @@ export default function Navbar() {
{t("partners")} - +
From 80bba9eb226fe0f69850fca848cb885ee6aedea0 Mon Sep 17 00:00:00 2001 From: Pratham Kamthan Date: Thu, 15 Jan 2026 13:00:48 +0530 Subject: [PATCH 3/3] fix: update DocsNavbar links to use getBaseUrl for localized URLs Signed-off-by: Pratham Kamthan --- src/components/docs/DocsNavbar.tsx | 32 +++++++++++++++--------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/src/components/docs/DocsNavbar.tsx b/src/components/docs/DocsNavbar.tsx index 7cb47fd8..ab01e259 100644 --- a/src/components/docs/DocsNavbar.tsx +++ b/src/components/docs/DocsNavbar.tsx @@ -6,7 +6,7 @@ import Image from "next/image"; import { useTheme } from "next-themes"; // import { useSearchParams, usePathname, useRouter } from 'next/navigation' import { VERSIONS } from '@/config/versions' -import { getLocalizedUrl } from "@/lib/url"; +import { getLocalizedUrl, getBaseUrl } from "@/lib/url"; import { VersionSelector } from './VersionSelector'; type DropdownType = "contribute" | "community" | "language" | "github" | null; @@ -360,8 +360,8 @@ export default function DocsNavbar() { Products - Ladder - + Programs - Contact Us - - + Partners - +
)} @@ -896,7 +896,7 @@ export default function DocsNavbar() { Products - Ladder - + {/* --- REMOVED LADDER LINK FROM HERE --- */} - Contact Us - - + Partners - + {/* Version selector - mobile */}