diff --git a/static/js/autocomplete.js b/static/js/autocomplete.js index 6f1c19b..7bdbb14 100644 --- a/static/js/autocomplete.js +++ b/static/js/autocomplete.js @@ -101,9 +101,13 @@ document.addEventListener('DOMContentLoaded', () => { searchInput.value = query; resultsWrapper.innerHTML = ''; searchWrapper.classList.remove('wrapper-searching'); - const form = searchInput.closest('form'); - form ? form.submit() : window.location.href = `/search?q=${encodeURIComponent(query)}&t=web`; - } + + // Retrieve the `t` parameter from the hidden input or set a default + const currentTemplateType = document.querySelector('input[name="t"]').value || 'web'; + + // Redirect to the appropriate results page + window.location.href = `/search?q=${encodeURIComponent(query)}&t=${encodeURIComponent(currentTemplateType)}`; + } // Handle clicks on search suggestions resultsWrapper.addEventListener('click', (event) => { diff --git a/templates/files.html b/templates/files.html index c25751d..b344339 100755 --- a/templates/files.html +++ b/templates/files.html @@ -17,6 +17,7 @@