@@ -18,7 +18,7 @@ const placeHolder = envApiKey != null ? 'Search the Segment documentation' : 'Se
1818const searchClient = algoliasearch ( appId , apiKey ) ;
1919
2020//insights
21- insightsClient ( 'init' , { appId, apiKey } ) ;
21+ insightsClient ( 'init' , { appId, apiKey, useCookie : true } ) ;
2222const algoliaInsightsPlugin = createAlgoliaInsightsPlugin ( { insightsClient } ) ;
2323
2424// define locations to separate invocation for mobile and desktop
@@ -39,9 +39,9 @@ function initAutocomplete(item){
3939 sourceId : 'articles' ,
4040 getItemUrl ( { item } ) {
4141 if ( item . anchor != null ) {
42- var itemUrl = item . url + "#" + item . anchor ;
42+ var itemUrl = '/docs' + item . url + "#" + item . anchor ;
4343 } else {
44- var itemUrl = item . url ;
44+ var itemUrl = '/docs' + item . url ;
4545 }
4646 return itemUrl ;
4747 } ,
@@ -87,9 +87,19 @@ function initAutocomplete(item){
8787 } ,
8888 navigator : {
8989 navigate ( { itemUrl } ) {
90- window . location . assign ( '/docs' + itemUrl ) ;
90+ window . location . assign ( itemUrl ) ;
9191 } ,
92- }
92+ navigateNewTab ( { itemUrl } ) {
93+ const windowReference = window . open ( itemUrl , '_blank' , 'noopener' ) ;
94+
95+ if ( windowReference ) {
96+ windowReference . focus ( ) ;
97+ }
98+ } ,
99+ navigateNewWindow ( { itemUrl } ) {
100+ window . open ( itemUrl , '_blank' , 'noopener' ) ;
101+ } ,
102+ } ,
93103 } ) ;
94104
95105}
0 commit comments