gethugothemes / parsa-hugo

Parsa is a personal blog theme powered by Hugo. It also can be used for portfolio website.
https://gethugothemes.com/products/parsa/?utm_source=parsa_github&utm_medium=referral&utm_campaign=github_theme_about
MIT License
157 stars 321 forks source link

search form not working #47

Closed ftorres16 closed 3 years ago

ftorres16 commented 3 years ago

Hi,

I am using the parsa-hugo theme for a personal blog, and I am using the latest version from the master branch on Gihub.

I have noticed that the search bar doesn't seem to be working for me on the production version of my blog (it works fine on hugo server).

When I type a search term on the search bar and hit enter it redirects me to https:///search/ so no results are found.

I have found that when I do it with the local server the URL is instead http://localhost:1313/search/?s=, which works just fine.

What is more, if I manually tipe the ?s=<search_term> on the live version I can see the search results just fine.

I am not sure how to continue debugging this issue, or if it is related to parsa-hugo or my own build/deploy process.

somratpro commented 3 years ago

Hello @ftorres16

Thanks for using our template, you can see the latest build of our theme is performing well on search https://themes.gohugo.io//theme/parsa-hugo/

I think you messed with your baseURL, that's why this is happening to you.

ftorres16 commented 3 years ago

Hello @somratpro

Thanks for your reply.

I double checked and the baseurl field in config.toml and it matches the URL of my blog with the same formatting as in example site.

I also inspected the search form in the HTML for the example you provided and compared it to my own. They match perfectly, aside from the URL in "action".

I inspected the requests on my browser and my blog is sending the request to https://<blog>.com/search?s=test (same as on your demo).

However, on my blog I get a 302 response with the header location /search/ that takes me back to an empty search page.

I also noticed that /search/?s=<search_term> works fine on my website, but not /search?s=<search_term>.

I figured it could be because my folder structure was content/search/_index.md and the example site had content/search.md, but I made the change and it is still not working.

somratpro commented 3 years ago

Well, can you share your repository with me?

ftorres16 commented 3 years ago

I sent you an invite

somratpro commented 3 years ago

try to add / at the end of your baseURL. baseurl = "https://lapolino.com/"

ftorres16 commented 3 years ago

When I do that and search I get two // after .com but none between the search and the ?s=<term>. So instead of an empty search page I get 404

somratpro commented 3 years ago

Ok, then remove it. and I give an update to the theme, try it now

ftorres16 commented 3 years ago

It worked, thanks!

somratpro commented 3 years ago

So a star to the repository would be fantastic.