mirror of
https://github.com/tenrok/bootstrap.git
synced 2026-06-05 16:42:29 +03:00
Alternative solution.
Rely on `site.url` which is different for production. In that case do nothing with the search result, otherwise when in development remove our url from it.
This commit is contained in:
@@ -115,8 +115,13 @@
|
||||
},
|
||||
transformData: function (hits) {
|
||||
return hits.map(function (hit) {
|
||||
var baseurl = document.getElementById('search-input').getAttribute('data-baseurl')
|
||||
hit.url = hit.url.replace('https://getbootstrap.com' + baseurl, baseurl)
|
||||
// When in production, return the result as is,
|
||||
// otherwise remove our url from it.
|
||||
var siteurl = document.getElementById('search-input').getAttribute('data-siteurl')
|
||||
var urlRE = /^https?:\/\/getbootstrap\.com/
|
||||
|
||||
hit.url = siteurl.match(urlRE) ? hit.url : hit.url.replace(urlRE, '')
|
||||
|
||||
return hit
|
||||
})
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user