Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions site/docs/4.1/assets/js/src/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,6 @@
algoliaOptions: {
facetFilters: ['version:' + siteDocsVersion]
},
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) {
var siteurl = getOrigin()
Expand All @@ -47,6 +41,12 @@
// otherwise remove our url from it.
hit.url = siteurl.match(urlRE) ? hit.url : hit.url.replace(urlRE, '')

// Prevent jumping to first header
if (hit.anchor === 'content') {
hit.url = hit.url.replace(/#content$/, '')
hit.anchor = null
}

return hit
})
},
Expand Down