From 97de17b5863268f65832bd388b0680abe701b574 Mon Sep 17 00:00:00 2001 From: Kian Newman-Hazel Date: Wed, 19 Feb 2025 20:23:44 +0000 Subject: [PATCH] [Docs Site] Fix regression for anchors in search results --- src/plugins/docsearch/index.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/docsearch/index.ts b/src/plugins/docsearch/index.ts index 3c7fccb3839d90..782dfd36fb7bb7 100644 --- a/src/plugins/docsearch/index.ts +++ b/src/plugins/docsearch/index.ts @@ -9,8 +9,8 @@ export default { // can be used in local development and previews. transformItems(items) { return items.map((item) => { - const path = new URL(item.url).pathname; - const url = new URL(path, window.origin); + const { pathname, hash } = new URL(item.url); + const url = new URL(pathname + hash, window.location.origin); return { ...item,