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

Add search functionality? #163

Closed
palant opened this issue May 18, 2020 · 6 comments
Closed

Add search functionality? #163

palant opened this issue May 18, 2020 · 6 comments

Comments

@palant
Copy link
Collaborator

palant commented May 18, 2020

Would it make sense to contribute the search functionality from palant.info? Hugo website recommends hugo-lunr for lunr.js integration which is an unnecessarily complicated way to do it and will fail in some scenarios. This functionality can be easily integrated into a theme, with lunr.js script as the only external dependency. The search itself will work on the client side then, without any server-side support (search index generated as a JSON file by Hugo itself).

@he-sb
Copy link

he-sb commented May 18, 2020

It would be awesome!🎉

@reuixiy
Copy link
Owner

reuixiy commented May 19, 2020

Guess we can do it then.

@reuixiy reuixiy added this to the v4.4.0 milestone May 19, 2020
@dawnow
Copy link

dawnow commented May 19, 2020

@reuixiy Is this guy's wish coming true? #84

@reuixiy
Copy link
Owner

reuixiy commented May 19, 2020

@dawnow Hmmm, not sure, as that issue is lack of description... Anyway, maybe we can close it when we close this. 🤔

@palant
Copy link
Collaborator Author

palant commented May 19, 2020

Ok, I'm generalizing the code, will create a pull request shortly.

@palant
Copy link
Collaborator Author

palant commented May 19, 2020

Pull request is #165.

@palant palant closed this as completed in fb54c61 May 21, 2020
ulmefors pushed a commit to ulmefors/hugo-theme-meme that referenced this issue Nov 22, 2020
Fixes reuixiy#163 

* feat: Added search capability via lunr

* doc: Fixed typo

* chore: Updated resource files of the example site

* chore: Remove unnecessary div wrapping search results

* chore: Reverted change of the config documentation

* chore: Ordered config entries correctly

* fix: Update document title when displaying search results

* fix: Handle a 404 error when downloading search index

* Use menu variable for icon

* Adjust search icon's style

* fix: Make back button work for restoring previous page state

* fix: Respect search state even when coming back from another page or site

* fix: Support non-English languages

* chore: port config.toml to zh-cn

* i18n: add zh, pt-br translations

* Increase `postWidth` and `listWidth` to `39em`

Otherwise search box will warp to a new line.

* Update screenshots

* Update resources

* fix: Update URL when searching

Co-authored-by: reuixiy <reuixiy@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants