I try to implement a searchbox following this tutorial https://learn.cloudcannon.com/jekyll/jekyll-search-using-lunr-js/ and get 404 page not found error like this https://nhatdang1411.github.io/search.html?query=ád
Your problem is unrelated to the search setup.
You have a page search.html
in your repo.
But because of this in your config
permalink: /:year-:month-:day-:title/
the result is /search/
. So the page is actually there.
See
If you want .html
then your permalink in the config should be this, with exnsion and no trailing slash.
permalink: /:year-:month-:day-:title:output_ext
Read more on Permalink in the docs. Here are the Builtin Formats
And you also have a page called Search.md
which becomes /Search/
I would get rid of the one and just keep lowercase /search/
Without building your site locally, I was able to see what paths you have by checking you sitemap.
https://nhatdang1411.github.io/sitemap.xml
See for example:
...
<loc>https://nhatdang1411.github.io/Search/</loc>
...
<loc>https://nhatdang1411.github.io/search/</loc>
I would recommend linking to your search page from other pages or the menu using the link
tag`. Then you can change your permalink setting without having to update URLs on each page.
Go to [Search]({{ site.baseurl }}{% link search.html %})
- that becomes [Search](/search/)
Read more about my site on [About]({{ site.baseurl }}{% link foo/about.md %})
- that becomes [About](/foo/about/) for example or .html