Skip to content

Commit

Permalink
update docsearch config to handle h1s properly (load top of page, not…
Browse files Browse the repository at this point in the history
… at the h1)
  • Loading branch information
mdo committed Jul 8, 2017
1 parent 6eee028 commit 6436233
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions _includes/scripts.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@
apiKey: '48cb48b22351bc71ea5f12f4d1ede198',
indexName: 'bootstrap-v4',
inputSelector: '#search-input',
handleSelected: function (input, event, suggestion) {
var url = suggestion.url;
url = suggestion.isLvl1 ? url.split('#')[0]: url;
// If it's a title we remove the anchor so it does not jump.
window.location.href = url;
},
transformData: function (hits) {
return hits.map(function (hit) {
hit.url = hit.url.replace('https://v4-alpha.getbootstrap.com', '/docs/4.0');
Expand Down

0 comments on commit 6436233

Please sign in to comment.