@@ -18,7 +18,7 @@ const placeHolder = envApiKey != null ? 'Search the Segment documentation' : 'Se
18
18
const searchClient = algoliasearch ( appId , apiKey ) ;
19
19
20
20
//insights
21
- insightsClient ( 'init' , { appId, apiKey } ) ;
21
+ insightsClient ( 'init' , { appId, apiKey, useCookie : true } ) ;
22
22
const algoliaInsightsPlugin = createAlgoliaInsightsPlugin ( { insightsClient } ) ;
23
23
24
24
// define locations to separate invocation for mobile and desktop
@@ -39,9 +39,9 @@ function initAutocomplete(item){
39
39
sourceId : 'articles' ,
40
40
getItemUrl ( { item } ) {
41
41
if ( item . anchor != null ) {
42
- var itemUrl = item . url + "#" + item . anchor ;
42
+ var itemUrl = '/docs' + item . url + "#" + item . anchor ;
43
43
} else {
44
- var itemUrl = item . url ;
44
+ var itemUrl = '/docs' + item . url ;
45
45
}
46
46
return itemUrl ;
47
47
} ,
@@ -87,9 +87,19 @@ function initAutocomplete(item){
87
87
} ,
88
88
navigator : {
89
89
navigate ( { itemUrl } ) {
90
- window . location . assign ( '/docs' + itemUrl ) ;
90
+ window . location . assign ( itemUrl ) ;
91
91
} ,
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
+ } ,
93
103
} ) ;
94
104
95
105
}
0 commit comments