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

HTML code generated for Search is incorrect (using Fuse does not work). #343

Open
ghost opened this issue Apr 4, 2023 · 2 comments
Open

Comments

@ghost
Copy link

ghost commented Apr 4, 2023

The HTML generated for my index page is below (first time user of Hugo) and as a web designer I am able to fix however just wanted to let you know that it is not adding /pages to the path and search is currently not working using fuse unless it is manually changed. Maybe I have not set it up correctly however not sure as I have only just started using. Also, not sure could this be due to the theme I am using (not Hugo itself) sorry to waste your time if it is.

So when I generate the site it creates the HTML below

 <form action='/search' id='search-form' class='search-form'>
 <label>

However the search page is not located at the site root so it only works if you manually change the HTML to add the /pages to the path.

  <form action='/pages/search' id='search-form' class='search-form'>
  <label>
@ghost
Copy link
Author

ghost commented Apr 4, 2023

I have located the problem, in themes\minimo\layouts\partials\widgets\search.html the code is currently as below and does not work for me using Fuse.

<form action='{{ "search" | relLangURL }}' id='search-form' class='search-form'>
<label>

However, if you change it to below then it is fine and builds will work fine - adding pages/ before search in form action="

 <form action='{{ "pages/search" | relLangURL }}' id='search-form' class='search-form'>
 <label>

@MunifTanjim
Copy link
Owner

MunifTanjim commented Apr 4, 2023

This might be because of how you've configured your site.

The example site (source: https://github.com/MunifTanjim/minimo/tree/master/exampleSite) uses fuse and it's working 🤔 https://minimo.netlify.app/search/?q=search

This config is probably relevant:

[permalinks]
page = "/:slug/"

This creates the search page at /search instead of pages/search.

If you don't want to change that globally, you should be able to adjust the slug for only search page, by adding this in that page's frontmatter:

---
slug: search
---

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

1 participant