A parent link needs to understand route structure. Removing the last character sequence can accidentally discard a locale or a meaningful base segment.
Worked example
"use client";
// components/ParentRouteLink.tsx
import Link from "next/link";
import { usePathname } from "next/navigation";
export default function ParentRouteLink({ href = "/studio" }: { href?: string } = {}) {
const path = usePathname();
const parent = path.split("/").filter(Boolean).slice(0, -1).join("/");
return <Link href={"/" + parent}>Up one level</Link>;
}Implementation notes
A locale root or application base path can be the logical parent even when string manipulation suggests another segment. Build explicit links for those roots.
Try it yourself
Compare navigation from a detail page with navigation from the section root.
Open the Next.js example →Editorial date August 8, 2026 · Published December 6, 2026