Commit 12f51086 authored by XhmikosR's avatar XhmikosR
Browse files

search.js: remove `window.location.origin` workaround

parent eaf616c6
Showing with 1 addition and 15 deletions
+1 -15
......@@ -20,19 +20,6 @@
}
})
function getOrigin() {
var location = window.location
var origin = location.origin
if (!origin) {
var port = location.port ? ':' + location.port : ''
origin = location.protocol + '//' + location.hostname + port
}
return origin
}
window.docsearch({
apiKey: '5990ad008512000bba2cf951ccf0332f',
indexName: 'bootstrap',
......@@ -42,10 +29,9 @@
},
transformData: function (hits) {
return hits.map(function (hit) {
var currentUrl = getOrigin()
var liveUrl = 'https://v5.getbootstrap.com/'
hit.url = currentUrl.startsWith(liveUrl) ?
hit.url = window.location.origin.startsWith(liveUrl) ?
// On production, return the result as is
hit.url :
// On development or Netlify, replace `hit.url` with a trailing slash,
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment