minimo icon indicating copy to clipboard operation
minimo copied to clipboard

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

Open ghost opened this issue 1 year ago • 2 comments

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 avatar Apr 04 '23 16:04 ghost

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>

ghost avatar Apr 04 '23 16:04 ghost

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: https://github.com/MunifTanjim/minimo/blob/0e119b2343eaf2bdb60801a65d0d33d0236ef18c/exampleSite/config.toml#L128-L129

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
---

MunifTanjim avatar Apr 04 '23 16:04 MunifTanjim