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) docsearch(options)
} }
function getRelativePath(absoluteUrl: string) { function getRelativePath(url: string) {
const { pathname, hash } = new URL(absoluteUrl) const { pathname, hash } = new URL(url, location.origin)
return ( return (
pathname.replace( pathname.replace(
/\.html$/, /\.html$/,

Loading…
Cancel
Save