Make search result URLs always point to the current site

This commit is contained in:
Natalie Weizenbaum 2019-04-17 17:29:12 -07:00
parent b75fca5a61
commit 05d3c9121d

View File

@ -157,6 +157,15 @@
apiKey: 'a409ff5d6a2476083c1a8dd1f8c04ec5',
indexName: 'sass-lang',
inputSelector: 'input.search',
transformData: function(hits) {
var domain = window.location.origin + "/";
hits.forEach(function(hit) {
if (!hit.url.startsWith(domain)) {
hit.url = hit.url.replace(/^https?:\/\/[^\/]+\//, domain);
}
});
return hits;
},
debug: false
});
= javascript_include_tag 'vendor/modernizr.custom.min'