gohugoio / hugoDocs

The source for https://gohugo.io/
Apache License 2.0
1.06k stars 1.49k forks source link

Site Search Resources #2376

Closed gavinr closed 9 months ago

gavinr commented 5 years ago

I really think we need to improve the "site search" story for Hugo. The Search for your Hugo Website page is insufficient - there are too many half-baked options listed. Why not have a single, well-documented recommended setup? Here are a few specific issues but I'm really more interested in a holistic improvement of the "site search" story.

Thanks to the Hugo team for a quality product - I really appreciate it and am just trying to give some feedback to help future users.

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. The resources of the Hugo team are limited, and so we are asking for your help. If this is a bug and you can still reproduce this error on the master branch, please reply with all of the information you have about it in order to keep the issue open. If this is a feature request, and you feel that it is still relevant and valuable, please tell us why. This issue will automatically be closed in the near future if no further activity occurs. Thank you for all your contributions.

gavinr commented 4 years ago

This is a long-term feature request - would request an opt-out from the auto-stale-bot for discussion sake.

bep commented 4 years ago

Why not have a single, well-documented recommended setup?

I agree that this issue is important, but it's hard to come up with a single solution cause the setup kind of depends ... so you may end up with a 1) Client side only solution (Lunr is an exellen choice), 2) A fully hosted solution (Algolia) or 3) A Self-hosted server solution (e.g. Bleve).

And those options are just for the search index. Some other static gens have better stories in this area, and I think the main reason we don't do so well here is that we are JS-framework-agnostic.

budparr commented 4 years ago

Hugo-lunr works just fine (just tested it). It appears to be stable, as is Lunr. Algolia may be an advanced and—sometimes paid—product, but it's a good tool (I use it a lot) and also has an open source version that's in use on the Hugo website. Not sure about the others, but according to NPMJS, Grunt has a stable half-million weekly downloads, so it's still relevant to some.

In my opinion, while the list is incomplete, the links that are there may be helpful to some, particularly because Hugo is used by a wide variety of people around the world with different skills, toolsets and budgets.

gavinr commented 4 years ago

@bep @budparr thank you for the thoughtful responses. I think you structured it well, and I think the page should maybe reflect that - something like:


A static website with a dynamic search function? Yes, Hugo provides an alternative to embeddable scripts from Google or other search engines for static websites. Hugo allows you to provide your visitors with a custom search function by indexing your content files directly. Depending on your needs, you may want a client-side only solution, a fully hosted solution, or a self-hosed server solution

client-side only solution

[text about when to use client-side only solutions]

Lunr.js is our recommended format for search index when using client-side only solutions. Some Libraries that allow you to easily create Lunr.js indexes from hugo include:

[LIST OF LIBRARIES with links and short descriptions, like hugo-lunr, etc]

fully hosted solution

[text about when to use fully hosted solutions]

[LIST OF SERVICES with links and short descriptions, like algolia, etc]

self-hosed server solutions

[text about when to use self-hosed server solutions]

[LIST OF LIBRARIES with links and short descriptions, like Bleve, etc]


Let me know what you think of this approach. I'm happy to create a PR if you think i'm on the right track.

Brixy commented 4 years ago

It's hard to come up with a single solution cause the setup kind of depends …

gomakethings.com uses a vanilla/plain JavaScript search script which does not require a JSON file.

How about adding something this simple and fast to Hugo for optional use out of the box.

We would only need a similar search template and an sample form which could be implemented anywhere in a template.

All other options can be implemented by the user as documented on the Hugo website.

Zola has search functionalities on board, see the “Comparisons with other static site generators” table.

jmooring commented 9 months ago

Closing in favor of https://github.com/gohugoio/hugoDocs/issues/1573