From 581271acc2753d631c6d1a46d33758eaad0e5234 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Greg=20Berg=C3=A9?= Date: Thu, 8 May 2025 08:19:01 +0200 Subject: [PATCH] Fix URL in sitemap --- .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 0000000000..9503e2afb1 --- /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 857345703c..b84565d1e7 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; }