From e6ddc0f07fc5e889e8c672c63ad488845f3522b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Greg=20Berg=C3=A9?= Date: Thu, 8 May 2025 08:54:28 +0200 Subject: [PATCH] Fix sitemap URLs (#3220) --- .changeset/healthy-parrots-call.md | 6 ++++++ packages/gitbook-v2/src/lib/links.ts | 5 +++++ 2 files changed, 11 insertions(+) create mode 100644 .changeset/healthy-parrots-call.md diff --git a/.changeset/healthy-parrots-call.md b/.changeset/healthy-parrots-call.md new file mode 100644 index 000000000..9503e2afb --- /dev/null +++ b/.changeset/healthy-parrots-call.md @@ -0,0 +1,6 @@ +--- +"gitbook-v2": patch +"gitbook": patch +--- + +Fix URL in sitemap diff --git a/packages/gitbook-v2/src/lib/links.ts b/packages/gitbook-v2/src/lib/links.ts index 857345703..b84565d1e 100644 --- a/packages/gitbook-v2/src/lib/links.ts +++ b/packages/gitbook-v2/src/lib/links.ts @@ -93,6 +93,11 @@ export function createLinker( }, toAbsoluteURL(absolutePath: string): string { + // If the path is already a full URL, we return it as is. + if (URL.canParse(absolutePath)) { + return absolutePath; + } + if (!servedOn.host) { return absolutePath; }