Docsearch modify url

by maxiloc

HTML

<!-- at the end of the HEAD -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/docsearch.js/2/docsearch.min.css" />
<!-- at the end of the BODY -->
<script type="text/javascript" src="https://cdn.jsdelivr.net/docsearch.js/2/docsearch.min.js"></script>
<input id="input" />

JavaScript

docsearch({
  apiKey: '48cb48b22351bc71ea5f12f4d1ede198',
  indexName: 'bootstrap-v4',
  inputSelector: '#input',
  handleSelected: function (input, event, suggestion) {
  	var url = suggestion.url;
    
    // modify the url
    
    window.location.href = url;
  },
  debug: false // Set debug to true if you want to inspect the dropdown
});