Skip to content

Commit

Permalink
Merge pull request #20868 from dvdksn/fix-prefill-searchqueryparam
Browse files Browse the repository at this point in the history
fix: prefill query param on search
  • Loading branch information
dvdksn authored Sep 12, 2024
2 parents f19919a + 55a45c1 commit bb5bbf6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions layouts/_default/search.html
Original file line number Diff line number Diff line change
Expand Up @@ -143,11 +143,11 @@ <h1 class="py-4">{{ .Title }}</h1>
for (let i = 1; i <= resultsLength / 10; i++) {
if (i == currentPage) {
resultsHTML += `<li class="text-center text-white">
<a href="/search?q=${query}&page=${i}" class="block h-6 w-6 rounded-sm bg-blue-light dark:bg-blue-dark">${i}</a>
<a href="{{ site.BaseURL }}search?q=${query}&page=${i}" class="block h-6 w-6 rounded-sm bg-blue-light dark:bg-blue-dark">${i}</a>
</li>`;
} else {
resultsHTML += `<li class="text-center text-gray-light dark:text-gray-dark">
<a href="/search?q=${query}&page=${i}" class="block h-6 w-6 rounded-sm bg-gray-light-200 dark:bg-gray-dark-200">${i}</a>
<a href="{{ site.BaseURL }}search?q=${query}&page=${i}" class="block h-6 w-6 rounded-sm bg-gray-light-200 dark:bg-gray-dark-200">${i}</a>
</li>`;
}
}
Expand Down
2 changes: 1 addition & 1 deletion layouts/partials/search-bar.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
{{ (resources.Get "images/search-ai.svg").Content | safeHTML }}
<input x-ref="searchBarInput" type="search" id="search-bar-input" @click="open = true" @focus="open = true;"
@blur.window.capture="$refs.searchBarRef.contains($event.relatedTarget) || (open = false);"
@keyup.enter.prevent="window.location.href = '/search?q=' + $event.target.value;"
@keyup.enter.prevent="window.location.href = '{{ site.BaseURL }}search?q=' + $event.target.value;"
@keyup.escape.prevent="open = false;" @keydown.window="(e) => {
switch(e.key) {
case 'k':
Expand Down

0 comments on commit bb5bbf6

Please sign in to comment.