diff --git a/src/components/Navigation.tsx b/src/components/Navigation.tsx index d6b5b9e58..a0efeee71 100644 --- a/src/components/Navigation.tsx +++ b/src/components/Navigation.tsx @@ -97,7 +97,7 @@ export function Navigation({ // Prepends version (if any) to the link path const prependVersion = (path: string) => { - return version ? `/v/${version}${path}` : path; + return version && path.startsWith('/') ? `/v/${version}${path}` : path; }; // Handle versions diff --git a/src/components/NavigationLink.tsx b/src/components/NavigationLink.tsx index 0fb3556d8..c3b833f95 100644 --- a/src/components/NavigationLink.tsx +++ b/src/components/NavigationLink.tsx @@ -13,6 +13,14 @@ export function NavigationLink(props: NavigationLinkProps) { const [hasIntent, setHasIntent] = useState(false); const markIntent = () => setHasIntent(true); + // next/link treats an absolute URL on our own origin (sourcegraph.com/pricing) + // as an app route and prefetches the marketing page's HTML. Plain anchors + // for anything with a scheme. + if (typeof props.href === 'string' && /^https?:\/\//.test(props.href)) { + const {href, ...anchorProps} = props; + return ; + } + return (