mirror of https://github.com/docker/docs.git
Merge pull request #20879 from dvdksn/search-urlquery-take2
site: fix search page redirects
This commit is contained in:
commit
ab05691edd
|
@ -143,11 +143,11 @@
|
|||
for (let i = 1; i <= resultsLength / 10; i++) {
|
||||
if (i == currentPage) {
|
||||
resultsHTML += `<li class="text-center text-white">
|
||||
<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>
|
||||
<a href="/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="{{ 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>
|
||||
<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>
|
||||
</li>`;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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 = '{{ site.BaseURL }}search?q=' + $event.target.value;"
|
||||
@keyup.enter.prevent="window.location.href = '/search/?q=' + $event.target.value;"
|
||||
@keyup.escape.prevent="open = false;" @keydown.window="(e) => {
|
||||
switch(e.key) {
|
||||
case 'k':
|
||||
|
@ -91,7 +91,7 @@
|
|||
})
|
||||
.join("");
|
||||
if (resultsLength > 5) {
|
||||
resultsHTML += `<div class="w-fit ml-auto px-4 py-2"><a href="/search?q=${query}" class="link">Show all results</a></div>`;
|
||||
resultsHTML += `<div class="w-fit ml-auto px-4 py-2"><a href="/search/?q=${query}" class="link">Show all results</a></div>`;
|
||||
}
|
||||
|
||||
searchBarResults.innerHTML = resultsHTML;
|
||||
|
|
Loading…
Reference in New Issue