bridgetownrb / bridgetown

A next-generation progressive site generator & fullstack framework, powered by Ruby
https://www.bridgetownrb.com
MIT License
1.16k stars 112 forks source link

feat: Search functionality #216

Closed bkmgit closed 3 years ago

bkmgit commented 3 years ago

Summary

It may be helpful to add search functionality to static sites.

Motivation

This feature is available in other static site generators, for example: https://gohugo.io/tools/search/

It would make finding content in generated sites and navigating them much easier.

Guide-level explanation

When generating your static website, you would also generate a site index file that would enable a javascript program to quickly find content on your site.

Possible software that could be used includes: https://fusejs.io/ https://lunrjs.com

Might also consider a separate gem to do the indexing.

Reference-level explanation

Drawbacks

A javascript browser solution is likely ok if adopted. In future, for larger sites one could consider integration with Elasticsearch or similar.

ayushn21 commented 3 years ago

There's an official Bridgetown plugin that integrates Lunr.js.

https://github.com/bridgetownrb/bridgetown-quick-search

Would this accomplish the functionality you're after @bkmgit?

bkmgit commented 3 years ago

@ayushn21 Awesome. Thanks.