Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Redirect to root if search query is empty #260

Merged
merged 10 commits into from
Sep 11, 2024
5 changes: 5 additions & 0 deletions scripts/app.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
// Redirect if the URL contains an empty search query
const urlParams = new URLSearchParams(window.location.search);
YouFoundAlpha marked this conversation as resolved.
Show resolved Hide resolved
if (urlParams.has('search') && urlParams.get('search').trim() === '') {
window.location.href = '/'; // Redirect to the root URL if search parameter is empty
}
const container = document.querySelector('.container');
const defaultImage = "https://oyepriyansh.pages.dev/i/5nf5fd.png";
const searchInput = document.getElementById('searchInput'); // Assuming there's an input field for searching
Expand Down
Loading