@@ -8,19 +8,20 @@ import {
88 OnDestroy ,
99 OnInit ,
1010 Renderer2 ,
11- ViewEncapsulation ,
11+ ViewEncapsulation
1212} from '@angular/core' ;
1313import { NavigationEnd , Router } from '@angular/router' ;
1414import { fromEvent , Subscription } from 'rxjs' ;
1515import { debounceTime } from 'rxjs/operators' ;
16+ import { environment } from '../../environments/environment' ;
1617import { BasePageComponent } from './pages/page/page.component' ;
1718
1819@Component ( {
1920 selector : 'app-homepage' ,
2021 templateUrl : './homepage.component.html' ,
2122 styleUrls : [ './homepage.component.scss' ] ,
2223 encapsulation : ViewEncapsulation . None ,
23- changeDetection : ChangeDetectionStrategy . OnPush ,
24+ changeDetection : ChangeDetectionStrategy . OnPush
2425} )
2526export class HomepageComponent implements OnInit , OnDestroy , AfterViewInit {
2627 isSidebarOpened = true ;
@@ -35,7 +36,7 @@ export class HomepageComponent implements OnInit, OnDestroy, AfterViewInit {
3536 private readonly cd : ChangeDetectorRef ,
3637 private readonly router : Router ,
3738 private readonly elementRef : ElementRef ,
38- private readonly renderer : Renderer2 ,
39+ private readonly renderer : Renderer2
3940 ) { }
4041
4142 ngOnInit ( ) : void {
@@ -58,7 +59,7 @@ export class HomepageComponent implements OnInit, OnDestroy, AfterViewInit {
5859
5960 ngAfterViewInit ( ) {
6061 this . checkWindowWidth ( window . innerWidth ) ;
61- this . contentRef . appendChild ( this . createDocSearchScriptTag ( ) )
62+ this . contentRef . appendChild ( this . createDocSearchScriptTag ( ) ) ;
6263 }
6364
6465 ngOnDestroy ( ) {
@@ -87,7 +88,7 @@ export class HomepageComponent implements OnInit, OnDestroy, AfterViewInit {
8788 const nativeElement : HTMLElement = this . elementRef . nativeElement ;
8889 const footerRef : HTMLElement = nativeElement . querySelector ( 'app-footer' ) ;
8990 const newsletterRef : HTMLElement = nativeElement . querySelector (
90- '.newsletter-wrapper' ,
91+ '.newsletter-wrapper'
9192 ) ;
9293 const carbonRef = nativeElement . querySelector ( '#carbonads' ) ;
9394 if ( ! footerRef || ! carbonRef ) {
@@ -144,18 +145,19 @@ export class HomepageComponent implements OnInit, OnDestroy, AfterViewInit {
144145 }
145146
146147 createDocSearchScriptTag ( ) : HTMLScriptElement {
147- const scriptTag = document . createElement ( "script" ) ;
148- scriptTag . type = "text/javascript" ;
149- scriptTag . src = "https://cdn.jsdelivr.net/npm/docsearch.js@2/dist/cdn/docsearch.min.js" ;
150- scriptTag . async = true
148+ const scriptTag = document . createElement ( 'script' ) ;
149+ scriptTag . type = 'text/javascript' ;
150+ scriptTag . src =
151+ 'https://cdn.jsdelivr.net/npm/docsearch.js@2/dist/cdn/docsearch.min.js' ;
152+ scriptTag . async = true ;
151153 scriptTag . onload = ( ) => {
152154 ( window as any ) . docsearch ( {
153- apiKey : '9ea53de1a6911255834352bbbe4d3417' ,
155+ apiKey : environment . algoliaApiKey ,
154156 indexName : 'nestjs' ,
155- inputSelector : '#q ' ,
156- debug : false // Set debug to true if you want to inspect the dropdown
157- } )
157+ inputSelector : '#search ' ,
158+ debug : false
159+ } ) ;
158160 } ;
159- return scriptTag
161+ return scriptTag ;
160162 }
161163}
0 commit comments