diff options
Diffstat (limited to 'assets/js/src')
| -rw-r--r-- | assets/js/src/application.js | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/assets/js/src/application.js b/assets/js/src/application.js index 2d8b08d1d..a35202f1d 100644 --- a/assets/js/src/application.js +++ b/assets/js/src/application.js @@ -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 }) }, |
