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

search 404 after set uglyurls = true #423

Open
skyao opened this issue Jan 20, 2021 · 3 comments
Open

search 404 after set uglyurls = true #423

skyao opened this issue Jan 20, 2021 · 3 comments

Comments

@skyao
Copy link
Contributor

skyao commented Jan 20, 2021

By default search works, when I do search with a keyword, it will open page:

http://localhost:1313/search/?q=keyword

but when I set uglyurls = true and do a search in the page, it will report 404 error.

The url is still:

http://localhost:1313/search/?q=keyword

I think it shoud be ( when uglyurls = true):

http://localhost:1313/search.html/?q=keyword

So the issue is that the search url is not correctly set when uglyurls = true.

@skyao
Copy link
Contributor Author

skyao commented Jan 20, 2021

I found that in assets/js/search.js:

var query = $(this).val();
var searchPage = "{{ "search/" | absURL }}?q=" + query;
document.location = searchPage;

Here "search/" is hard code as search page url.

@LisaFC
Copy link
Collaborator

LisaFC commented Jan 21, 2021

Oh well spotted. I'll see if I can come up with a nice solution but in the meantime you can just add your own version of that file to your project with search.html so your search page will show up.

@skyao
Copy link
Contributor Author

skyao commented Jan 22, 2021

Oh well spotted. I'll see if I can come up with a nice solution but in the meantime you can just add your own version of that file to your project with search.html so your search page will show up.

Thank you.

Yes, I really did as what you said to work around this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants