Remove url patch in algolia

This commit is contained in:
Zhengyi Lai 2023-05-18 08:23:34 +00:00
parent 7b07444fd4
commit e34e388a74

View File

@ -17,24 +17,24 @@ docsearch({
facetFilters: [`lang:${language}`],
hitsPerPage: 10,
},
transformData: function(hits) {
hits.forEach(hit => {
if (typeof window !== undefined) {
var host = window.location.host
if (host == 'kubesphere.com.cn') {
if (language == 'en') {
host = host + '/en'
hit.url = hit.url.replace('kubesphere.io', host)
} else if (language == 'zh') {
hit.url = hit.url.replace('kubesphere.io/zh', host)
}
} else {
hit.url = hit.url.replace('kubesphere.io', host)
}
}
})
return hits
},
// transformData: function(hits) {
// hits.forEach(hit => {
// if (typeof window !== undefined) {
// var host = window.location.host
// if (host == 'kubesphere.com.cn') {
// if (language == 'en') {
// host = host + '/en'
// hit.url = hit.url.replace('kubesphere.io', host)
// } else if (language == 'zh') {
// hit.url = hit.url.replace('kubesphere.io/zh', host)
// }
// } else {
// hit.url = hit.url.replace('kubesphere.io', host)
// }
// }
// })
// return hits
// },
debug: false,
})
</script>