diff --git a/assets/ts/search.tsx b/assets/ts/search.tsx index 856b48d..1c81dd1 100644 --- a/assets/ts/search.tsx +++ b/assets/ts/search.tsx @@ -53,7 +53,14 @@ class Search { this.resultTitle = resultTitle; this.resultTitleTemplate = resultTitleTemplate; - this.handleQueryString(); + /// Check if there's already value in the search input + if (this.input.value.trim() !== '') { + this.doSearch(this.input.value.split(' ')); + } + else { + this.handleQueryString(); + } + this.bindQueryStringChange(); this.bindSearchForm(); } diff --git a/layouts/404.html b/layouts/404.html index b89d2b6..98f4a67 100644 --- a/layouts/404.html +++ b/layouts/404.html @@ -3,5 +3,43 @@

{{ T "notFound.title" }}

{{ T "notFound.subtitle" }}

+ + {{- $query := first 1 (where .Site.Pages "Layout" "==" "search") -}} + {{- $searchPage := index $query 0 -}} + + {{- with $searchPage -}} +
+

+ + + + +

+
+ +
+

+
+
+ + + + {{- $opts := dict "minify" hugo.IsProduction "JSXFactory" "createElement" -}} + {{- $searchScript := resources.Get "ts/search.tsx" | js.Build $opts -}} + + + + {{- end -}} {{ partialCached "footer/footer" . }} {{ end }} \ No newline at end of file