fix: make algolia search work with indices that don't return absolute urls (#2956)

closes #336, closes #805
pull/2964/head
Frederic Schwarz 1 year ago committed by GitHub
parent d1d985ea99
commit 2a34c6b307
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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$/,

Loading…
Cancel
Save