File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -177,13 +177,19 @@ define([
177
177
178
178
allWidgetConfiguration = this . configureFacets ( allWidgetConfiguration ) ;
179
179
180
+ // allWidgetConfiguration = this.configureRedirects(allWidgetConfiguration)
181
+
180
182
if ( algoliaConfig . analytics . enabled ) {
181
183
allWidgetConfiguration . analytics = this . getAnalyticsWidget ( )
182
184
}
183
185
184
186
return allWidgetConfiguration ;
185
187
} ,
186
188
189
+ // configureRedirects(allWidgetConfiguration) {
190
+ // return allWidgetConfiguration;
191
+ // },
192
+
187
193
/**
188
194
* Process a passed widget config object and add to InstantSearch
189
195
* Dynamic widgets are deferred as they must be aggregated and processed separately
@@ -966,6 +972,11 @@ define([
966
972
if ( algoliaConfig . showSuggestionsOnNoResultsPage ) {
967
973
customWidgets . push ( this . getSuggestionsWidget ( this . minQuerySuggestions ) ) ;
968
974
}
975
+
976
+ const allowRedirects = true ;
977
+ if ( allowRedirects ) {
978
+ customWidgets . push ( this . getRedirectWidget ( ) ) ;
979
+ }
969
980
return customWidgets ;
970
981
} ,
971
982
@@ -1052,6 +1063,20 @@ define([
1052
1063
} ;
1053
1064
} ,
1054
1065
1066
+ getRedirectWidget ( ) {
1067
+ return {
1068
+ render ( { results } ) {
1069
+ if (
1070
+ results &&
1071
+ results . renderingContent &&
1072
+ results . renderingContent . redirect
1073
+ ) {
1074
+ window . location . href = results . renderingContent . redirect . url ;
1075
+ }
1076
+ } ,
1077
+ } ;
1078
+ } ,
1079
+
1055
1080
////////////////////////////
1056
1081
// Merchandising //
1057
1082
////////////////////////////
You can’t perform that action at this time.
0 commit comments