From 2a34c6b3076bf418b3abbbca984fcb033743a611 Mon Sep 17 00:00:00 2001 From: Frederic Schwarz Date: Wed, 13 Sep 2023 21:22:01 +0200 Subject: [PATCH] fix: make algolia search work with indices that don't return absolute urls (#2956) closes #336, closes #805 --- src/client/theme-default/components/VPAlgoliaSearchBox.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/client/theme-default/components/VPAlgoliaSearchBox.vue b/src/client/theme-default/components/VPAlgoliaSearchBox.vue index b50f9ff6..04652295 100644 --- a/src/client/theme-default/components/VPAlgoliaSearchBox.vue +++ b/src/client/theme-default/components/VPAlgoliaSearchBox.vue @@ -84,8 +84,8 @@ function initialize(userOptions: DefaultTheme.AlgoliaSearchOptions) { docsearch(options) } -function getRelativePath(absoluteUrl: string) { - const { pathname, hash } = new URL(absoluteUrl) +function getRelativePath(url: string) { + const { pathname, hash } = new URL(url, location.origin) return ( pathname.replace( /\.html$/,