Skip to content

Commit 9bd088e

Browse files
remove base path URL in docs (#2375)
1 parent 84a7b07 commit 9bd088e

6 files changed

Lines changed: 17 additions & 32 deletions

File tree

web/apps/docs/app/layout.config.tsx

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,12 @@ import type { BaseLayoutProps } from "fumadocs-ui/layouts/shared";
33

44
export const baseOptions: BaseLayoutProps = {
55
nav: {
6-
// basePath="/docs" so the logo SVG resolves under the docs server's
7-
// basePath. Without this, <img src="/logo-light.svg"> 404s when the
8-
// docs app is hit directly.
9-
title: <Logo size="md" basePath="/docs" />,
6+
title: <Logo size="md" />,
107
url: "/",
118
transparentMode: "top",
129
},
1310
// Only the GitHub icon in the top-nav. Cross-app links back to marketing
14-
// (/product, /pricing, /resources) were removed — they 404'd inside the
15-
// docs basePath and clutter a docs-focused nav.
11+
// (/product, /pricing, /resources) clutter a docs-focused nav.
1612
links: [
1713
{
1814
type: "icon",

web/apps/docs/app/layout.tsx

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1+
import { source } from "@/lib/source";
2+
import { DocsLayout } from "fumadocs-ui/layouts/docs";
13
import { RootProvider } from "fumadocs-ui/provider";
24
import { GeistMono } from "geist/font/mono";
35
import { GeistSans } from "geist/font/sans";
46
import type { Metadata } from "next";
57
import type { ReactNode } from "react";
6-
import { DocsLayout } from "fumadocs-ui/layouts/docs";
7-
import { source } from "@/lib/source";
88
import { baseOptions } from "./layout.config";
99
import "./globals.css";
1010

@@ -13,9 +13,8 @@ export const metadata: Metadata = {
1313
default: "NativeLink Docs",
1414
template: "%s — NativeLink Docs",
1515
},
16-
description:
17-
"Documentation for NativeLink — high-performance remote build cache & execution.",
18-
metadataBase: new URL("https://nativelink.com"),
16+
description: "Documentation for NativeLink — high-performance remote build cache & execution.",
17+
metadataBase: new URL("https://docs.nativelink.com"),
1918
};
2019

2120
export default function RootLayout({ children }: { children: ReactNode }) {
@@ -41,7 +40,7 @@ export default function RootLayout({ children }: { children: ReactNode }) {
4140
enableSystem: true,
4241
storageKey: "nl-theme",
4342
}}
44-
search={{ options: { api: "/docs/api/search" } }}
43+
search={{ options: { api: "/api/search" } }}
4544
>
4645
<DocsLayout tree={source.pageTree} {...baseOptions}>
4746
{children}

web/apps/docs/app/sitemap.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
import type { MetadataRoute } from "next";
21
import { source } from "@/lib/source";
2+
import type { MetadataRoute } from "next";
33

4-
const BASE_URL = "https://nativelink.com";
4+
const BASE_URL = "https://docs.nativelink.com";
55

66
export default function sitemap(): MetadataRoute.Sitemap {
77
const lastModified = new Date();
88
return source.getPages().map((page) => ({
99
url: `${BASE_URL}${page.url}`,
1010
lastModified,
1111
changeFrequency: "weekly" as const,
12-
priority: page.url === "/docs" ? 0.9 : 0.6,
12+
priority: page.url === "/" ? 0.9 : 0.6,
1313
}));
1414
}

web/apps/docs/lib/source.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
import { docs } from "@/.source";
22
import { loader } from "fumadocs-core/source";
33

4-
// baseUrl is "/" because Next.js basePath ("/docs") prepends to every
5-
// next/link href automatically. If we put "/docs" here as well, the
6-
// sidebar would emit /docs/foo and next/link would double-prefix it to
7-
// /docs/docs/foo.
84
export const source = loader({
95
baseUrl: "/",
106
source: docs.toFumadocsSource(),

web/apps/docs/next.config.mjs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,6 @@ const withMDX = createMDX();
55
/** @type {import('next').NextConfig} */
66
const nextConfig = {
77
reactStrictMode: true,
8-
// Docs ship under /docs. With basePath set, every internal Next.js link
9-
// and every emitted asset URL (/_next/static/*) is automatically
10-
// prefixed — which is what makes the marketing dev rewrite work for
11-
// both pages and assets in one rule.
12-
basePath: "/docs",
138
transpilePackages: ["@nativelink/ui"],
149
};
1510

web/apps/web/next.config.mjs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,25 +8,24 @@ const nextConfig = {
88
{ protocol: "https", hostname: "github.com" },
99
],
1010
},
11-
// Marketing serves the apex; the docs app lives at /docs/* and is a
12-
// separate Vercel deployment. We proxy here so /docs URLs stay on the
13-
// marketing origin (SEO, cookies, one set of analytics).
11+
// Marketing serves the apex; the docs app lives on docs.nativelink.com.
12+
// Redirect /docs links there so old URLs and local nav links keep working.
1413
//
1514
// Production: target is process.env.DOCS_URL (set on Vercel).
1615
// Development: target is process.env.DOCS_DEV_URL or localhost:3001.
17-
async rewrites() {
16+
async redirects() {
1817
const target =
1918
process.env.NODE_ENV === "production"
2019
? process.env.DOCS_URL
2120
: (process.env.DOCS_DEV_URL ?? "http://localhost:3001");
2221

23-
// If we're in production and DOCS_URL isn't set, skip the rewrite
24-
// entirely — better to 404 cleanly than to proxy to nothing.
22+
// If we're in production and DOCS_URL isn't set, skip the redirect
23+
// entirely — better to 404 cleanly than to redirect to nothing.
2524
if (!target) return [];
2625

2726
return [
28-
{ source: "/docs", destination: `${target}/docs` },
29-
{ source: "/docs/:path*", destination: `${target}/docs/:path*` },
27+
{ source: "/docs", destination: target, permanent: false },
28+
{ source: "/docs/:path*", destination: `${target}/:path*`, permanent: false },
3029
];
3130
},
3231
};

0 commit comments

Comments
 (0)