Skip to content

Commit 1c7f403

Browse files
committed
fix(docs): force-dynamic robots and sitemap routes
Metadata routes don't inherit the root layout's force-dynamic, so both were prerendered at build time with the build-time DOCS_URL (usually the fallback) baked in. Forcing dynamic rendering resolves the runtime host, matching the pattern used in apps/docs/app/layout.tsx.
1 parent 8a87010 commit 1c7f403

2 files changed

Lines changed: 10 additions & 0 deletions

File tree

apps/docs/app/robots.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@ import { docsBaseUrl } from "@/lib/base-url";
22

33
import type { MetadataRoute } from "next";
44

5+
// Metadata routes don't inherit the root layout's force-dynamic; without it
6+
// this route is prerendered at build time with the build-time DOCS_URL
7+
// (usually the fallback) baked in instead of the runtime value.
8+
export const dynamic = "force-dynamic";
9+
510
export default function robots(): MetadataRoute.Robots {
611
return {
712
rules: [

apps/docs/app/sitemap.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@ import { source } from "@/lib/source";
33

44
import type { MetadataRoute } from "next";
55

6+
// Metadata routes don't inherit the root layout's force-dynamic; without it
7+
// this route is prerendered at build time with the build-time DOCS_URL
8+
// (usually the fallback) baked in instead of the runtime value.
9+
export const dynamic = "force-dynamic";
10+
611
export default function sitemap(): MetadataRoute.Sitemap {
712
// No lastModified: stamping a build-time date on every URL marks the whole
813
// sitemap as freshly changed on each deploy, which trains crawlers to

0 commit comments

Comments
 (0)